Re: Handy describe_pg_lock function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Handy describe_pg_lock function
Date: 2019-11-10 05:42:40
Message-ID: 22079.1573364560@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> On 2019-11-08 14:49:25 +0800, Craig Ringer wrote:
>> I recently found the need to pretty-print the contents of pg_locks. So
>> here's a little helper to do it, for anyone else who happens to have that
>> need. pg_identify_object is far from adequate for the purpose. Reckon I
>> should turn it into C and submit?

> Yea, I think we need to make it easier for users to understand
> locking. I kind of wonder whether part of the answer would be to change
> the details that pg_locks shows, or add a pg_locks_detailed or such
> (presumably a more detailed version would include walking the dependency
> graph to at least some degree, and thus more expensive).

I think the actual reason why pg_locks is so bare-bones is that it's
not supposed to require taking any locks of its own internally. If,
for example, we changed the database column so that it requires a lookup
in pg_database, then the view would stop working if someone had an
exclusive lock on pg_database --- pretty much exactly the kind of case
you might wish to be investigating with that view.

I don't have any objection to adding a more user-friendly layer
to use for normal cases, but I'm hesitant to add any gotchas like
that into the basic view.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2019-11-10 06:35:40 Re: proposal: minscale, rtrim, btrim functions for numeric
Previous Message Amit Kapila 2019-11-10 05:13:33 Re: Coding in WalSndWaitForWal