pg_stat_slru

显示有关缓存页面访问信息的统计视图

pg_stat_slru 是一个 统计视图,显示有关缓存页面访问的信息。具体来说,它提供了一种监控各种使用 SLRU(简单最近最少使用)算法进行缓存驱逐的较小缓存的方法,最初旨在帮助开发和基准测试。

pg_stat_slruPostgreSQL 13 中添加。

统计重置

可以通过执行以下命令来重置 pg_stat_slru 显示的单个或所有缓存统计信息:

SELECT pg_stat_reset_slru()

请注意,缓存名称已在 PostgreSQL 17 中更改;有关详细信息,请参阅 pg_stat_reset_slru()

按 PostgreSQL 版本定义

pg_stat_slru (PostgreSQL 17)

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

文档: pg_stat_slru

pg_stat_slru (PostgreSQL 16)

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

文档: pg_stat_slru

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

文档: 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 |           |          |
    

文档: 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 |           |          |
    

文档: pg_stat_slru

更改历史记录

示例

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)

分类

统计/监控视图

另请参见

pg_stat_reset_slru()

反馈

提交任何关于 "pg_stat_slru" 的评论、建议或更正 此处