Re: Foreign Key Deadlocking

From: Csaba Nagy
Subject: Re: Foreign Key Deadlocking
Date: ,
Msg-id: 1176910597.16187.75.camel@coppola.muc.ecircle.de
(view: Whole thread, Raw)
In response to: Foreign Key Deadlocking  ("Steven Flatt")
Responses: Re: Foreign Key Deadlocking  (Dave Cramer)
List: pgsql-performance

Tree view

Foreign Key Deadlocking  ("Steven Flatt", )
 Re: Foreign Key Deadlocking  (Csaba Nagy, )
  Re: Foreign Key Deadlocking  (Dave Cramer, )
   Re: Foreign Key Deadlocking  (Erik Jones, )
   Re: Foreign Key Deadlocking  (Alvaro Herrera, )
    Re: Foreign Key Deadlocking  (Csaba Nagy, )
 Re: Foreign Key Deadlocking  (Tom Lane, )
  Re: Foreign Key Deadlocking  ("Steven Flatt", )

> Can someone confirm that I've identified the right fix?

I'm pretty sure that won't help you... see:

http://archives.postgresql.org/pgsql-general/2006-12/msg00029.php

The deadlock will be there if you update/insert the child table and
update/insert the parent table in the same transaction (even if you
update some other field on the parent table than the key referenced by
the child table). If your transactions always update/insert only one of
those tables, it won't deadlock (assuming you order the inserts/updates
properly per PK).

Cheers,
Csaba.




pgsql-performance by date:

From: "Steven Flatt"
Date:
Subject: Re: Foreign Key Deadlocking
From: "Merlin Moncure"
Date:
Subject: Re: Basic Q on superfluous primary keys