On Wed, Jun 18, 2008 at 05:39:59PM -0700, Jeff Davis wrote:
> I was trying to create a more "at-a-glance" view of the pg_locks table.
> I included the SQL I came up with (after talking to Merlin) at the
> bottom of this message.
>
> The idea is to show any queries that are waiting on a lock, and the
> query that currently holds the lock on which those queries are waiting.
>
> Is my logic correct?
I'm not exactly sure, but it appears to match, at first blush, what's
in src/backend/storage/lmgr/lock.c:
static const LOCKMASK LockConflicts[] = {
> Does anyone have any suggestions?
The function could be in SQL, with one minor bit in PL/PgSQL. File
attached.
> I couldn't find a generally accepted way to do this, although I'm sure
> someone must have done something like this before.
There's stuff in the aforementioned lock.c, but I don't see anything
visible to SQL.
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate