>"Himanshu Baweja" <himanshubaweja@yahoo.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