Re: deadlocks in multiple-triggers environment

From: Alvaro Herrera <alvherre(at)surnet(dot)cl>
To: hubert depesz lubaczewski <depesz(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: deadlocks in multiple-triggers environment
Date: 2005-06-09 14:17:22
Message-ID: 20050609141722.GA10414@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Csaba Nagy 2005-06-09 14:26:44 Re: deadlocks in multiple-triggers environment
Previous Message Phil Endecott 2005-06-09 14:16:11 Propogating conditions into a query