Re: Row locking during UPDATE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David F(dot) Skoll" <dfs(at)roaringpenguin(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Row locking during UPDATE
Date: 2003-09-04 14:06:07
Message-ID: 22649.1062684367@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"David F. Skoll" <dfs(at)roaringpenguin(dot)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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Jouneau Luc 2003-09-04 14:26:46 max_fsm_pages
Previous Message Rodrigo De la Peña 2003-09-04 13:44:50 unsubscrib