Database deadlock/hanging

John Gateley <gateley@jriver.com>

From: John Gateley <gateley@jriver.com>
To: pgsql-general@postgresql.org
Date: 2007-03-07T16:08:42Z
Lists: pgsql-general
Hi,

My database stopped responding last night (Postgres 8.1.4).

at 2 am, a vacuum began running:
/usr/local/pgsql/bin/vacuumdb -afz

When I came in to work this morning, I could query some tables
but not others. There were many(100) processes like:
postgres 11791  6901  0 02:07 ?        00:00:00 postgres: www-data yadb2 127.0.0.1(40883) SELECT waiting

I began running an update yesterday that may or may not have completed.
I was moving data out of one table into a new table, and setting
an ID field to point to the new table. That may or may not have
completed (it was done by this morning). It is not a regular occurence
and today was the first time I saw this hanging behavior, so it's
probably related.

The postmaster was using a lot of CPU.

I stopped the postmaster with a SIGINT, it stopped quickly
and came back up automatically (I'm using daemontools) and
everything is fine.

I'm guessing it's something related to table locks.

Any pointers on what I should be looking for to prevent this from
happening again? What information I should be tracking to figure
out what is exactly happening?

Thanks very much,

j