Skip site navigation (1) Skip section navigation (2)

Re: row-level deadlock problem

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>,Kamil Kaczkowski <kamil(at)kamil(dot)eisp(dot)pl>, pgsql-general(at)postgresql(dot)org
Subject: Re: row-level deadlock problem
Date: 2004-11-27 19:29:48
Message-ID: 20041127192948.GB31246@dcc.uchile.cl (view raw or flat)
Thread:
Lists: pgsql-general
On Sat, Nov 27, 2004 at 12:58:36PM -0500, Tom Lane wrote:
> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> > Well, there has to be something, since an UPDATE in Read Committed mode
> > simply doesn't have any locks that can deadlock.
> 
> You're mistaken; it takes a row lock on each row it updates.  I'm not
> sure why the two UPDATEs are visiting the same rows in different orders,
> but if they do the failure is certainly possible.

One of them could be using an indexscan while the other is not.  If the
heap is in reverse order compared to the scan, that would explain it.

Is there a solution to this problem?  The FK deadlock problem can be
fixed with shared row locks, but this is a different one.

-- 
Alvaro Herrera (<alvherre[(at)]dcc(dot)uchile(dot)cl>)
"La felicidad no es maƱana. La felicidad es ahora"

In response to

Responses

pgsql-general by date

Next:From: Kamil KaczkowskiDate: 2004-11-27 20:13:17
Subject: Re: row-level deadlock problem
Previous:From: Chris GreenDate: 2004-11-27 18:49:31
Subject: Re: Can one alter the format of a numeric column?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group