Re: Deadlocks caused by referential integrity checks

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-general(at)postgresql(dot)org
Subject: Re: Deadlocks caused by referential integrity checks
Date: 2004-08-26 03:36:43
Message-ID: 200408260336.i7Q3ah204627@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Greg Stark <gsstark(at)mit(dot)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).

We would probably have to allow the deferred trigger queue to spill to
disk if we do that, of course.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jon Asher 2004-08-26 04:25:51 Querying large record sets
Previous Message Tom Lane 2004-08-26 03:25:26 Re: EXPLAIN ANALYZE total runtime != walltime