Re: Row locking during UPDATE - Mailing list pgsql-admin

From Tom Lane
Subject Re: Row locking during UPDATE
Date
Msg-id 22649.1062684367@sss.pgh.pa.us
Whole thread Raw
In response to Row locking during UPDATE  ("David F. Skoll" <dfs@roaringpenguin.com>)
Responses Re: Row locking during UPDATE  ("David F. Skoll" <dfs@roaringpenguin.com>)
List pgsql-admin
"David F. Skoll" <dfs@roaringpenguin.com> writes:
> What appears to be happening is this:

> 1) Sometimes, a whole bunch of clients try updating the same row.  I
> see sevaral postgresql processes marked "UPDATE waiting"

Any process that arrives at the row and finds it already modified by
some concurrent transaction will wait for that concurrent transaction
to complete.

> 2) Because the client processes must complete rather quickly, a supervisor
> process kills them if they don't complete soon.

Zapping clients that are in the middle of database operations is bad
design IMHO.

> 3) The postgresql processes in an "UPDATE waiting" state seem to be
> blocked waiting for a semaphore, and they do not notice the closing of
> the connection when the client is killed.

That's correct, a backend will generally not notice client disconnect
until it next waits for a client command.  It's not totally clear why
you've got so many processes waiting to update the same row, though.
Which process does have the row lock, and why isn't it completing its
transaction?

            regards, tom lane

pgsql-admin by date:

Previous
From: Rodrigo De la Peña
Date:
Subject: unsubscrib
Next
From: "AlmawElias Fantahun"
Date:
Subject: please remove me from the list