Re: Proposal: Expose oldest xmin as SQL function for monitoring

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Proposal: Expose oldest xmin as SQL function for monitoring
Дата
Msg-id 14378.1585777502@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Proposal: Expose oldest xmin as SQL function for monitoring  (James Coleman <jtc331@gmail.com>)
Ответы Re: Proposal: Expose oldest xmin as SQL function for monitoring
Список pgsql-hackers
James Coleman <jtc331@gmail.com> writes:
> To my knowledge the current oldest xmin (GetOldestXmin() if I'm not
> mistaken) isn't exposed directly in any view or function by Postgres.

You could do something like

select max(age(backend_xmin)) from pg_stat_activity;

though I'm not sure whether that accounts for absolutely every process.

> Am I missing anything in the above description? And if not, would
> there be any reason why we would want to avoid exposing that
> information? And if not, then would exposing it as a function be
> acceptable?

The fact that I had to use max(age(...)) in that sample query
hints at one reason: it's really hard to do arithmetic correctly
on raw XIDs.  Dealing with wraparound is a problem, and knowing
what's past or future is even harder.  What use-case do you
foresee exactly?

            regards, tom lane



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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: [PATCH] Incremental sort (was: PoC: Partial sort)
Следующее
От: Nino Floris
Дата:
Сообщение: Re: [PATCH] ltree, lquery, and ltxtquery binary protocol support