Get table total page quantity and cached page quantity

Поиск
Список
Период
Сортировка
От otar shavadze
Тема Get table total page quantity and cached page quantity
Дата
Msg-id CAG-jOyCd1oaf5RdDO86_txuH1oJ62uYV42SOBr1emuoHz2js0A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Get table total page quantity and cached page quantity  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-hackers
created pg_buffercache extension:
CREATE EXTENSION pg_buffercache;

restarted server and updated statistic for table :
VACUUM ANALYZE public.my_table;

then just tried to cache table in buffer:
SELECT * FROM public.my_table;

and then tried to get table total page quantity and how much pages are cached in buffer for this table:
SELECT
(SELECT relpages FROM pg_class where oid = 'public.my_table'::regclass::oid ) AS table_pages_quantity_total,
(SELECT COUNT(DISTINCT relblocknumber) FROM pg_buffercache WHERE relfilenode = (
SELECT relfilenode FROM pg_class WHERE oid = 'public.my_table'::regclass::oid -- (SELECT rel_oid FROM my_cte)
) ) AS table_pages_quantity_in_cache;


 This shows that table have only one page, while second column shows 3 unique pages in buffer cache. Seems I'm measuring those numbers incorrectly(?) can you please help, which column is incorrect (or may be both) ?

 

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

Предыдущее
От: "wangsh.fnst@fujitsu.com"
Дата:
Сообщение: RE: make MaxBackends available in _PG_init
Следующее
От: Ranier Vilela
Дата:
Сообщение: Re: CI/windows docker vs "am a service" autodetection on windows