Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id E31539FA341 for ; Wed, 18 Apr 2007 12:37:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 97213-03 for ; Wed, 18 Apr 2007 12:37:04 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail.ecircle.de (mail.ecircle.de [195.140.186.200]) by postgresql.org (Postfix) with ESMTP id 40D729FA0FB for ; Wed, 18 Apr 2007 12:37:04 -0300 (ADT) Received: from einstein.muc.ecircle.de (einstein.muc.ecircle.de [192.168.1.7]) by mail.ecircle.de (READY) with ESMTP id 2776B55C013; Wed, 18 Apr 2007 17:37:03 +0200 (CEST) Received: from [192.168.1.91] ([192.168.1.91]) by einstein.muc.ecircle.de with Microsoft SMTPSVC(6.0.3790.1830); Wed, 18 Apr 2007 17:36:37 +0200 Subject: Re: Foreign Key Deadlocking From: Csaba Nagy To: Steven Flatt Cc: postgres performance list In-Reply-To: <357fa7590704180807j1906d42u1f0f539ac561dc3e@mail.gmail.com> References: <357fa7590704180807j1906d42u1f0f539ac561dc3e@mail.gmail.com> Content-Type: text/plain Message-Id: <1176910597.16187.75.camel@coppola.muc.ecircle.de> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 18 Apr 2007 17:36:37 +0200 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 18 Apr 2007 15:36:37.0694 (UTC) FILETIME=[5A52D5E0:01C781CF] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/332 X-Sequence-Number: 24209 > 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.