Re: Need help understanding pg_locks - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Need help understanding pg_locks
Date
Msg-id 201107111529.p6BFTUT09704@momjian.us
Whole thread Raw
In response to Re: Need help understanding pg_locks  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Need help understanding pg_locks
List pgsql-hackers
Tom Lane wrote:
> Florian Pflug <fgp@phlo.org> writes:
> > On Jul11, 2011, at 05:47 , Bruce Momjian wrote:
> >> Thank you.  I think my confusion is that virtualtransaction is the lock
> >> holder/waiter, and the other two are actual locks.  The attached doc
> >> patch clarifies that.  I had actually realized this a few weeks ago and
> >> forgot, meaning this is pretty confusing.
> 
> > For consistency, I guess it should say "lock object" instead of simply
> > "object" the description of all the columns up to (and including)
> > "objsubid", not only those of "virtualxid" and "transactionid".
> 
> Yeah, I think this patch is going in the wrong direction altogether.
> It would be better to modify the description of virtualtransaction
> and pid to say that those are the "locking" entity.

OK, so as I understand it, in pg_locks:
       Column       |   Type   | Modifiers--------------------+----------+----------- locktype           | text     |
database          | oid      | relation           | oid      | page               | integer  | tuple              |
smallint| virtualxid         | text     | transactionid      | xid      | classid            | oid      | objid
    | oid      | objsubid           | smallint |
 
 virtualtransaction | text     | pid                | integer  | mode               | text     | granted            |
boolean |
 

It is the last four that are related to the "locking entity".  I don't
see a way of improving the description of the last four columns:
http://developer.postgresql.org/pgdocs/postgres/view-pg-locks.html

What was unclear to me was that the earlier columns (illogically)
vaguely represented the locked object.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Need help understanding pg_locks
Next
From: Bruce Momjian
Date:
Subject: Re: Need help understanding pg_locks