pg_stat_checkpointer

显示有关检查点信息的视图
此条目涉及PostgreSQL的一个功能,该功能是PostgreSQL 17的一部分,预计将于2024年底发布。

pg_stat_checkpointer 是一个系统统计视图,显示有关检查点的信息。

pg_stat_checkpointerPostgreSQL 17中添加,其中包含之前包含在pg_stat_bgwriter中的一些信息。

统计重置

可以通过执行以下命令重置pg_stat_checkpointer显示的统计信息:

SELECT pg_stat_reset_shared('checkpointer')

按PostgreSQL版本定义

pg_stat_checkpointer (PostgreSQL 17)

                     View "pg_catalog.pg_stat_checkpointer"
       Column        |           Type           | Collation | Nullable | Default 
---------------------+--------------------------+-----------+----------+---------
 num_timed           | bigint                   |           |          | 
 num_requested       | bigint                   |           |          | 
 restartpoints_timed | bigint                   |           |          | 
 restartpoints_req   | bigint                   |           |          | 
 restartpoints_done  | bigint                   |           |          | 
 write_time          | double precision         |           |          | 
 sync_time           | double precision         |           |          | 
 buffers_written     | bigint                   |           |          | 
 stats_reset         | timestamp with time zone |           |          |
    

文档: pg_stat_checkpointer

更改历史记录

示例

pg_stat_checkpointer的基本用法示例

postgres=# SELECT * FROM pg_stat_checkpointer;
 num_timed | num_requested | write_time | sync_time | buffers_written |          stats_reset          
-----------+---------------+------------+-----------+-----------------+-------------------------------
         1 |             1 |       4514 |         2 |              76 | 2023-10-31 10:31:48.064606+09
(1 row)


postgres=# CHECKPOINT;
CHECKPOINT

postgres=# SELECT * FROM pg_stat_checkpointer;
 num_timed | num_requested | write_time | sync_time | buffers_written |          stats_reset          
-----------+---------------+------------+-----------+-----------------+-------------------------------
         1 |             2 |       4516 |         3 |              76 | 2023-10-31 10:31:48.064606+09
(1 row)

重置pg_stat_checkpointer统计信息

postgres=# SELECT pg_stat_reset_shared('checkpointer');
 pg_stat_reset_shared 
----------------------
 
(1 row)

postgres=# SELECT * FROM pg_stat_checkpointer;
 num_timed | num_requested | write_time | sync_time | buffers_written |          stats_reset          
-----------+---------------+------------+-----------+-----------------+-------------------------------
         0 |             0 |          0 |         0 |               0 | 2023-10-31 10:48:28.553766+09
(1 row)

分类

统计/监控视图系统目录

另请参阅

pg_stat_bgwriter

反馈

提交任何关于“pg_stat_checkpointer”的评论、建议或更正 此处