Re: Foreign Keys and Deadlocks

From: Csaba Nagy <ncslists(at)googlemail(dot)com>
To: David Kerr <dmk(at)mr-paradox(dot)net>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Foreign Keys and Deadlocks
Date: 2011-11-10 08:09:06
Message-ID: 1320912546.22828.919.camel@clnt-sysecm-cnagy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raghavendra 2011-11-10 08:13:51 Re:
Previous Message Kalai R 2011-11-10 07:56:25 Re: dll files missing in postgrsql bin folder in Windows