Re: Update / Lock (and ShareLock) question - Mailing list pgsql-general

From Tom Lane
Subject Re: Update / Lock (and ShareLock) question
Date
Msg-id 3888.1215787890@sss.pgh.pa.us
Whole thread Raw
In response to Re: Update / Lock (and ShareLock) question  (Augustin Amann <augustin@waw.com>)
Responses Re: Update / Lock (and ShareLock) question
List pgsql-general
Augustin Amann <augustin@waw.com> writes:
> Tom Lane a écrit :
>> What that really means is that the first process is waiting for a row
>> lock that's held by the second one --- that is, it's trying to update a
>> row that the second transaction has updated and not yet committed.

> I understand. But a dead lock is for me, a situation that sould not
> appear, event if the storage is slow ... I'm wrong ?

If you're getting deadlocks on these, then what you have is two
concurrent transactions trying to update the same two tuples in
different orders.  Which is a classic deadlock case, and the only
fix is to fix your app so that multiple updates are done in some
consistent order --- or broken into multiple transactions.

            regards, tom lane

pgsql-general by date:

Previous
From: Vivek Khera
Date:
Subject: Re: view row-level locks
Next
From: "Francisco Reyes"
Date:
Subject: Default fill factor for tables?