Re: Deadlocks caused by referential integrity checks - Mailing list pgsql-general

From Tom Lane
Subject Re: Deadlocks caused by referential integrity checks
Date
Msg-id 12921.1093387678@sss.pgh.pa.us
Whole thread Raw
In response to Deadlocks caused by referential integrity checks  (Greg Stark <gsstark@mit.edu>)
Responses Re: Deadlocks caused by referential integrity checks  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general
Greg Stark <gsstark@mit.edu> writes:
> At least some versions of postgres ensure that constraint triggers will be
> executed in alphabetical order.

Only within a single event, though, so I don't think fooling with the
trigger names will do anything to resolve the sorts of problems people
are dealing with.

The most promising quick-fix I've heard suggested is to mark all the FK
constraints as deferred until end of transaction.  That would reduce the
time window in which the locks are held to a short interval and thus
make deadlocks less likely (not impossible, certainly, but less likely).

            regards, tom lane

pgsql-general by date:

Previous
From: Carlos Moreno
Date:
Subject: Re: Is this legal SQL? Is it a good practice?
Next
From: Stephan Szabo
Date:
Subject: Re: Deadlocks caused by referential integrity checks