From: Tom Lane <tgl@sss.pgh.pa.us>
To: David F. Skoll <dfs@roaringpenguin.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Row locking during UPDATE
Date: Thu, 04 Sep 2003 10:06:07 -0400
Message-ID: <22649.1062684367@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.55.0309040812310.1962@shishi.roaringpenguin.com>
References: <Pine.LNX.4.55.0309040812310.1962@shishi.roaringpenguin.com>
"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, dfs@roaringpenguin.com
Subject: Re: Row locking during UPDATE
In-Reply-To: <22649.1062684367@sss.pgh.pa.us>
References: <Pine.LNX.4.55.0309040812310.1962@shishi.roaringpenguin.com> <22649.1062684367@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox