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 15)

                      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 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

Examples

postgres=# SELECT * FROM pg_stat_slru;
      name       | blks_zeroed | blks_hit | blks_read | blks_written | blks_exists | flushes | truncates |          stats_reset          
-----------------+-------------+----------+-----------+--------------+-------------+---------+-----------+-------------------------------
 CommitTs        |           1 |       95 |         0 |            0 |           0 |       0 |         0 | 2021-11-03 11:08:05.213091+01
 MultiXactMember |           0 |        0 |         0 |            0 |           0 |       0 |         0 | 2021-11-03 11:08:05.213091+01
 MultiXactOffset |           0 |        0 |         0 |            0 |           0 |       0 |         0 | 2021-11-03 11:08:05.213091+01
 Notify          |           1 |        5 |         0 |            0 |           0 |       0 |         0 | 2021-11-03 11:08:05.213091+01
 Serial          |           0 |        0 |         0 |            0 |           0 |       0 |         0 | 2021-11-03 11:08:05.213091+01
 Subtrans        |           0 |        0 |         0 |            0 |           0 |       0 |         0 | 2021-11-03 11:08:05.213091+01
 Xact            |           0 |     1131 |         0 |            0 |           0 |       0 |         0 | 2021-11-03 11:08:05.213091+01
 other           |           0 |        0 |         0 |            0 |           0 |       0 |         0 | 2021-11-03 11:08:05.213091+01
(8 rows)

Categories

Statistics / monitoring view

See also

pg_stat_reset_slru()