Home > Archive > PostgreSQL Discussion > April 2006 > About checking all dead lock tables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author About checking all dead lock tables
Emi Lu

2006-04-06, 8:25 pm

Hello,

How to check whether a table is locked? Is there a way that I can find
all deadlocks under postgresql 8.0.1 ?

Thanks alot!
Ying Lu


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Michael Fuhr

2006-04-07, 3:36 am

On Thu, Apr 06, 2006 at 03:36:33PM -0400, Emi Lu wrote:
> How to check whether a table is locked?


You can monitor locks by querying the pg_locks view.

http://www.postgresql.org/docs/8.0/...ring-locks.html
http://www.postgresql.org/docs/8.0/...w-pg-locks.html

Only a few operations lock entire tables; for more information see
the Concurrency Control chapter in the documentation.

http://www.postgresql.org/docs/8.0/...ctive/mvcc.html

> Is there a way that I can find all deadlocks under postgresql 8.0.1 ?


Are you sure you mean "deadlocks"? Deadlock occurs when transaction
A holds a lock that transaction B wants and transaction B holds a
lock that transaction A wants; PostgreSQL detects this condition
and aborts one of the transactions, allowing the other to continue.
By default this happens after one second (see the deadlock_timeout
setting).

Perhaps you want to see pending or blocked lock attempts, i.e.,
locks that have been requested but are not yet acquired because
another transaction holds a conflicting lock. If that's the case
then look for rows in pg_locks where "granted" is false.

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com