public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alvaro Herrera <[email protected]>
To: Merlin Moncure <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: [HACKERS] pg_locks view and user locks
Date: Mon, 13 Sep 2004 16:02:25 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Mon, Sep 13, 2004 at 01:34:05PM -0400, Merlin Moncure wrote:

> First, the pg_locks view lists user level locks but doesn't really say
> much about them.  For example, for traditional locks we get the xid but
> for user locks we don't really get anything useful.  I looked in
> lockfuncs.c and didn't see that there would be any real penalty to
> displaying the offset/block of the user lock, and returning it in
> request from pg_locks.

ISTM it would be better to have pg_locks show only system locks, and
another view, say pg_userlocks, to show user locks.  This would allow to
show different data; for example, the PID of the process involved.
What's more, user locks and system locks never conflict, so it seems
wrong to show them together.

Another option would be to add another column to pg_locks to say what
lockmethod (1 for system, 2 for user) is used in each lock.

Maybe we want to separate locks even more, and use one table to show
xact locks, another to show table locks, and yet another to show user
locks.  But maybe this is a bad idea right from the start.

> Is this view frequently queried by system processes? 

I don't think there is a lot of server-side stuff (aside from possible
UDFs) that use pg_locks directly.  It's there only for user convenience.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Someone said that it is at least an order of magnitude more work to do
production software than a prototype. I think he is wrong by at least
an order of magnitude."                              (Brian Kernighan)




view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [HACKERS] pg_locks view and user locks
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox