Re: deadlocks in multiple-triggers environment - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: deadlocks in multiple-triggers environment
Date
Msg-id 20050609141722.GA10414@surnet.cl
Whole thread Raw
In response to deadlocks in multiple-triggers environment  (hubert depesz lubaczewski <depesz@gmail.com>)
Responses Re: deadlocks in multiple-triggers environment  (Csaba Nagy <nagy@ecircle-ag.com>)
List pgsql-general
On Wed, Jun 08, 2005 at 05:45:45PM +0200, hubert depesz lubaczewski wrote:
> hi
> i have a stituation a situation where i have multiple tables, and multiple
> triggers on all of them.
> at least 1 or 2 triggers on at lease 4 different tables does updates to main
> cache table.

Do say, are there foreign keys on those tables?

If there are, that may explain the deadlocks.  This is a known problem,
fixed in the development version, for which there is no complete
solution on current releases (except for dropping the foreign keys
completely.)  One workaround that may reduce the ocurrence of deadlocks
is to make the constraints INITIALLY DEFERRED, so that the checks happen
as late as possible in the transaction.

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
Thou shalt check the array bounds of all strings (indeed, all arrays), for
surely where thou typest "foo" someone someday shall type
"supercalifragilisticexpialidocious" (5th Commandment for C programmers)

pgsql-general by date:

Previous
From: Phil Endecott
Date:
Subject: Propogating conditions into a query
Next
From: Csaba Nagy
Date:
Subject: Re: deadlocks in multiple-triggers environment