Trying to find a renegade lock

From: Frank Kurzawa <fkurzawa(at)topazsoftware(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Trying to find a renegade lock
Date: 2004-08-24 17:47:54
Message-ID: 1093369674.5627.327.camel@zaza.aus.topazsoftware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Our web-based app suffers occasional dramatic slowdowns which appear to
be due to occasional contention for locked database resources.

I've done the following steps:
1. ps -efl | grep postgres
The output shows a number of connections in transaction, apparently
waiting on one another. Eventually they all clear.
2. psql -c "SELECT * FROM pg_stat_activity" template1
All of the entries have an empty query column.
3. I inspected pg_locks and found two entries:
___Relation____database_transaction__pid ________mode______granted_
(null) (null) 385025 10071 ExclusiveLock true
16757 16977 (null) 10071 AccessShareLock true

I'm trying to understand these results. PID 10071 is a connection from
one of our webservers. But relation 16757 doesn't appear to correspond
to any table in the database.
I don't know how to correspond the transaction id, 385025 with anything.
It certainly doesn't show up in the log file and I have statement
logging turned on.

Ultimately I want to be able to track this back to an offending query or
transaction that has been left open so that we can fix our source code.
How can I get there?

Regards,

--
Frank Kurzawa <fkurzawa(at)topazsoftware(dot)com>
Topaz Software, Inc.

Browse pgsql-novice by date

  From Date Subject
Next Message John Browne 2004-08-24 18:26:12 Questions about pg_dump file
Previous Message Mark Dexter 2004-08-24 17:46:58 Creating Functions in a Separate Schema