Re: Foreign Keys and Deadlocks - Mailing list pgsql-general

From Csaba Nagy
Subject Re: Foreign Keys and Deadlocks
Date
Msg-id 1320912546.22828.919.camel@clnt-sysecm-cnagy
Whole thread Raw
In response to Re: Foreign Keys and Deadlocks  (David Kerr <dmk@mr-paradox.net>)
Responses Re: Foreign Keys and Deadlocks  (David Kerr <dmk@mr-paradox.net>)
List pgsql-general
Hi David,

On Wed, 2011-11-09 at 09:52 -0800, David Kerr wrote:
> So, aside from removing the PKs do i have any other options?

Sure you have: order the inserts by primary key inside each transaction.
Then you will not get deadlocks, but inserting the same key again will
fail of course (but that's the purpose of the primary key, right ?)

Ordering inserts/updates by the columns which cause locks is the first
thing to do to avoid dead-locks...

Cheers,
Csaba.



pgsql-general by date:

Previous
From: Alexander Burbello
Date:
Subject: Exp/Imp data with blobs
Next
From: Dennis Ryan
Date:
Subject: How to list installed pl languages