Re: [HACKERS] pg_locks view and user locks

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>, pgsql-hackers(at)postgresql(dot)org, pgsql-docs(at)postgresql(dot)org
Subject: Re: [HACKERS] pg_locks view and user locks
Date: 2004-09-13 21:31:15
Message-ID: 24423.1095111075@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> writes:
> 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.

I think this is a bad idea, at least for the base-level view, because it
would imply that it's impossible to get a truly simultaneous view of the
state of all the locks. It would certainly be a bad idea to so separate
xact and table locks. I'd prefer to extend the present approach and add
columns that are NULL when the type of lock isn't relevant to them.

> 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.

How about a text column with values "TABLE", "XACT", "USER"?

regards, tom lane

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Peter Eisentraut 2004-09-14 07:11:47 Re: XOR example error in docs
Previous Message Tom Lane 2004-09-13 20:39:49 Re: pg_locks view and user locks

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2004-09-13 21:48:34 Re: beta1 & beta2 & Windows & heavy load
Previous Message Tom Lane 2004-09-13 21:25:42 Re: pg_locks view and user locks