Skip site navigation (1) Skip section navigation (2)

automatically detecting long timed locks

From: Tino Schwarze <postgresql(at)tisc(dot)de>
To: pgsql-admin(at)postgresql(dot)org
Subject: automatically detecting long timed locks
Date: 2007-09-12 20:46:57
Message-ID: 20070912204657.GC29139@easy2.in-chemnitz.de (view raw or flat)
Thread:
Lists: pgsql-admin
Hi there,

is there an easy way to detect locks which are held for a very long
time? We've got some problems with a database here where a lock is held
for 1 or 2 hours though the operation should be very quick. A lot of
other processes are then waiting for the lock to become available.

We would like to query for "lock on table xyz being held for more than
60 seconds" or the other way around "query has been waiting for lock on
table xyz for more than 60 seconds".

Of course, we get log entries like "LOG:  duration: 8544285.789 ms
execute <unnamed>: lock table "xyz" in exclusive mode", but this is
AFTER the lock got acquired. We'd like to notice if lock acquisition
takes very long so we can look around and figure out what's wrong.

How can we achieve this?

Thanks,

Tino.

PS: Version is 8.2.4.

-- 
www.spiritualdesign-chemnitz.de
www.lebensraum11.de

Tino Schwarze * Parkstra├če 17h * 09120 Chemnitz

Responses

pgsql-admin by date

Next:From: Scott MarloweDate: 2007-09-12 22:02:56
Subject: Re: automatically detecting long timed locks
Previous:From: Alvaro HerreraDate: 2007-09-12 20:30:28
Subject: Re: reindexdb hangs

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group