Re: getting lock information

Поиск
Список
Период
Сортировка
От Qingqing Zhou
Тема Re: getting lock information
Дата
Msg-id d70oqd$1nt1$1@news.hub.org
обсуждение исходный текст
Ответ на getting lock information  (Himanshu Baweja <himanshubaweja@yahoo.com>)
Ответы Re: getting lock information  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
>"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





В списке pgsql-general по дате отправления:

Предыдущее
От: Tim Allen
Дата:
Сообщение: Re: International Characters
Следующее
От: Tom Lane
Дата:
Сообщение: Re: getting lock information