Subject interleaved transactions and deadlocks
Author Ludovic Orban
Hi all,

I wondered if somebody could explain me why FB behaves differently
when two deadlocked transactions are executed in parallel either from
two connections or from a single one ?

For a bit of background, you can read this thread between a PostgreSQL
JDBC driver maintainer and I:
http://archives.postgresql.org/pgsql-jdbc/2006-11/msg00039.php

To summarize this thread:

FB has the ability to run multiple transactions on a single
connection. Now when two transactions that deadlock each others are
executed on two different connections, the DB immediately detects the
deadlock and an exception is thown.

Now when you create the very same deadlock between two transactions
running on the same connection (you can do that using the XAResource
interface) the DB has to wait until after the period of time specified
in the DeadlockTimeout DB config parameter elapsed.

Can somebody explain me the difference ? Heikki Linnakangas seems to
believe this is due to some deadlock that has nothing to do with
transaction isolation but that makes no sense to me as I have no
experience with DBMS engines.

Thanks in advance,
Ludovic