Re: getting lock information

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: getting lock information
Date: 2005-05-25 02:42:31
Message-ID: d70oqd$1nt1$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>"Himanshu Baweja" <himanshubaweja(at)yahoo(dot)com> writes
>I wanted to see which tables/transaction have acquired or are waiting for
which locks....
>as far as i know there are two ways to do it....
>
>1) pg_locks ::: need to write trigger... and have high overhead...
>

"select * from pg_locks" has trivial impact on the server. pg_locks is a
view

test=# \d pg_locks;
View "pg_catalog.pg_locks"
Column | Type | Modifiers
-------------+---------+-----------
relation | oid |
database | oid |
transaction | xid |
pid | integer |
mode | text |
granted | boolean |
View definition:
SELECT l.relation, l."database", l."transaction", l.pid, l."mode",
l.granted
FROM pg_lock_status() l(relation oid, "database" oid, "transaction" xid,
pid
integer, "mode" text, granted boolean);

and it retrives data from server internal lock data structure via
pg_lock_status() function.

What do you mean by "write trigger"?

>2) trace_locks,trace_lwlocks ... etc etc.... ::: well for this my server
says undefined parameters... >so as far as i know i need to rebuild the
server with some flag...
>

Yes, trace_locks is used when LOCK_DEBUG is defined, so you got to rebuild
your server.

Regards,
Qingqing

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-05-25 03:22:51 Re: getting lock information
Previous Message Tim Allen 2005-05-25 00:46:13 Re: International Characters