Re: Is the pg_locks been used?

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: Is the pg_locks been used?
Дата
Msg-id 1140943058.8830.164.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Is the pg_locks been used?  (Carlos Henrique Reimer <carlosreimer@yahoo.com.br>)
Список pgsql-general
On Thu, 2006-02-23 at 17:12 -0300, Carlos Henrique Reimer wrote:
> When the pg_locks view is used the internal lock manager data
> structures are momentarily locked and that is why I would like to know
> if some application is reading the pg_locks view and how many times.
>
> Is there a way to discover it?

AFAIK there is no easy way to determine this information. You could
probably patch Postgres to record the info fairly easy: one way would be
to allocate a small block of shared memory and an LWLock to protect it,
and then have pg_lock_status() acquire the lock and increment a counter.
Then add a new function to retrieve the current value of the counter.

You could even do it without modifying the backend proper: change the
definition of the pg_locks view to invoke a set-returning PL/PgSQL
function. That function would increment a counter stored in some table,
and then construct and return the normal pg_locks result set.

-Neil




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

Предыдущее
От: "Andrus Moor"
Дата:
Сообщение: Wish: remove ancient constructs from Postgres
Следующее
От: "Uwe C. Schroeder"
Дата:
Сообщение: Re: Wish: remove ancient constructs from Postgres