Re: pg_locks: who is locking ?

Поиск
Список
Период
Сортировка
От Alexandre Arruda
Тема Re: pg_locks: who is locking ?
Дата
Msg-id 4533FAE1.6070301@aldeiadigital.com.br
обсуждение исходный текст
Ответ на Re: pg_locks: who is locking ?  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: pg_locks: who is locking ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Alvaro Herrera escreveu:
> Alexandre Arruda wrote:
>> Hi,
>>
>> My Database have a lot of locks not granted every moments in a day.
>>
>> Can I create a view that returns someting like this ?
>>
>> User    Granted    Table    Who_is_locking_me  PID
>> ----    -------    -----    -----------------  ---
>> joe    f    foo    frank              1212
>> jeff    f    foo    frank              1313
>> ann    f    foo    frank              1414
>> frank    t    foo                   1111
>> (...)
>>
>> (Or the locked transactions, if the table cold't be retrived)
>
> You can look up more data about a backend by joining pg_locks to
> pg_stat_activity, using the PID (I think it's called procpid on one view
> and pid on the other).
>

Hi,

But pg_stat_activity joined with pg_locks only give me informations
about the lock itself.
Realy, I want a (possible) simple information: Who is locking me ?

Today, I *presume* this information by manually search the pg_locks:

1) Search for the locked tables
2) Search for all lock GRANTED to this tables
3) Generally, the older PID is the locker

Not so smart, I think. :)

Best regards,

Alexandre

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

Предыдущее
От: "Brandon Aiken"
Дата:
Сообщение: Re: Anyone using "POSIX" time zone offset capability?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Anyone using "POSIX" time zone offset capability?