Database locks

Started by Alex Turnerabout 21 years ago2 messagesgeneral
Jump to latest
#1Alex Turner
armtuk@gmail.com

I'm having a bear of a time with an application where one thread seems
to be keeping a lock on a table after it's supposed to release it.

select count(*) from pg_locks gives:
6816

Is there any way to get the list of locks by transation id or some
other datum to indicate which was first, or to figure out which is the
lock that is holding everything else back?

Alex Turner
netEconomist

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alex Turner (#1)
Re: Database locks

Alex Turner <armtuk@gmail.com> writes:

Is there any way to get the list of locks by transation id or some
other datum to indicate which was first, or to figure out which is the
lock that is holding everything else back?

Perhaps get some stats on the rows with granted=f to see what seems to be
blocking the most people.

regards, tom lane