Re: Is it possible to keep track of SELECTs?

Поиск
Список
Период
Сортировка
От Dominique Devienne
Тема Re: Is it possible to keep track of SELECTs?
Дата
Msg-id CAFCRh-8GKecKL9ojzigBnS0qix80vOi0E0LujH5pd2CufVEpCA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Is it possible to keep track of SELECTs?  (Christophe Pettus <xof@thebuild.com>)
Ответы Re: Is it possible to keep track of SELECTs?
Список pgsql-general
On Tue, Mar 12, 2024 at 3:30 PM Christophe Pettus <xof@thebuild.com> wrote:
> On Mar 12, 2024, at 07:15, Dominique Devienne <ddevienne@gmail.com> wrote:
> So is it possible to track the last time a SELECT was performed on some TABLE?

Directly, no.  You could periodically sample the various table-level statistics, and conclude that tables that have had some type of scan since the last scan have had a SELECT run against them.  It might not be 100% accurate if (for example) you reset the statistics or lose them for some other reason, but it might be sufficient for the application.

Bummer :(

PostgreSQL tables and indexes are ultimately files.
And there are ways to map them to file names, I've seen in the past.
So isn't it possible, provided the filesystem tracks last access time, to infer when a table was accessed the last time? 

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

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: Simple way to simulate a bug in logical replication
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Is it possible to keep track of SELECTs?