Re: [DOCS] pg_locks view and user locks - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [DOCS] pg_locks view and user locks
Date
Msg-id 24423.1095111075@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_locks view and user locks  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-hackers
Alvaro Herrera <alvherre@dcc.uchile.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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_locks view and user locks
Next
From: "Simon Riggs"
Date:
Subject: Re: SELECT FOR UPDATE NOWAIT and PostgreSQL 8.0