pg_stat_slru
A statistics view displaying information about access to cached pages
pg_stat_slru
is a statistics view displaying information about access to cached pages. Specifically it provides a way of monitoring various lesser caches which use the SLRU (simple least-recently-used) algorithm for cache eviction, and is initially intended to assist with development and benchmarking.
pg_stat_slru
was added in PostgreSQL 13.
Statistics reset
The statistics displayed by pg_stat_slru
can be reset by executing:
SELECT pg_stat_reset_slru()
Definition by PostgreSQL version
pg_stat_slru (PostgreSQL 14)
View "pg_catalog.pg_stat_slru" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+--------- name | text | | | blks_zeroed | bigint | | | blks_hit | bigint | | | blks_read | bigint | | | blks_written | bigint | | | blks_exists | bigint | | | flushes | bigint | | | truncates | bigint | | | stats_reset | timestamp with time zone | | |
Documentation: pg_stat_slru
pg_stat_slru (PostgreSQL 13)
View "pg_catalog.pg_stat_slru" Column | Type | Collation | Nullable | Default --------------+--------------------------+-----------+----------+--------- name | text | | | blks_zeroed | bigint | | | blks_hit | bigint | | | blks_read | bigint | | | blks_written | bigint | | | blks_exists | bigint | | | flushes | bigint | | | truncates | bigint | | | stats_reset | timestamp with time zone | | |
Documentation: pg_stat_slru
Change history
- PostgreSQL 13
- added (commit 28cac71b)
Examples
postgres=# SELECT * FROM pg_stat_slru ORDER BY name; name | blks_zeroed | blks_hit | blks_read | blks_written | blks_exists | flushes | truncates | stats_reset ------------------+-------------+----------+-----------+--------------+-------------+---------+-----------+------------------------------- async | 64779 | 0 | 0 | 64779 | 0 | 0 | 0 | 2020-05-09 06:43:51.951852+02 clog | 0 | 58757 | 9 | 0 | 0 | 0 | 0 | 2020-05-09 06:43:51.951852+02 commit_timestamp | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2020-05-09 06:43:51.951852+02 multixact_member | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2020-05-09 06:43:51.951852+02 multixact_offset | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 2020-05-09 06:43:51.951852+02 oldserxid | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2020-05-09 06:43:51.951852+02 other | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2020-05-09 06:43:51.951852+02 subtrans | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2020-05-09 06:43:51.951852+02
References
- PostgreSQL documentation: pg_stat_slru
Useful links
- CommitFest entry: SLRU stats