﻿.. _sys_stat_progress_checkpoint:

sys_stat_progress_checkpoint
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``sys_stat_progress_checkpoint`` 视图用于查询检查点（CHECKPOINT）的执行进度。

.. table:: sys_stat_progress_checkpoint 列
      :widths: 2 1 3
      :class: longtable

      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
      | 名称                  | 类型        | 描述                                                                                             |
      +=======================+=============+==================================================================================================+
      | ``pid``               | ``integer`` | checkpointer进程的pid号。                                                                        |
      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
      | ``phase``             | ``text``    | 检查点当前所处的阶段，取值如下：                                                                 |
      |                       |             |                                                                                                  |
      |                       |             | - prepare                                                                                        |
      |                       |             |                                                                                                  |
      |                       |             | - flush dirty clog pages                                                                         |
      |                       |             |                                                                                                  |
      |                       |             | - flush dirty commit_ts pages                                                                    |
      |                       |             |                                                                                                  |
      |                       |             | - flush dirty subtrans pages                                                                     |
      |                       |             |                                                                                                  |
      |                       |             | - flush dirty multi transaction pages                                                            |
      |                       |             |                                                                                                  |
      |                       |             | - truncate slru                                                                                  |
      |                       |             |                                                                                                  |
      |                       |             | - flush relation map                                                                             |
      |                       |             |                                                                                                  |
      |                       |             | - flush replication slots                                                                        |
      |                       |             |                                                                                                  |
      |                       |             | - remove serialized snapshots                                                                    |
      |                       |             |                                                                                                  |
      |                       |             | - logical rewrite mappings                                                                       |
      |                       |             |                                                                                                  |
      |                       |             | - write out all dirty buffers                                                                    |
      |                       |             |                                                                                                  |
      |                       |             | - process queued fsync requests                                                                  |
      |                       |             |                                                                                                  |
      |                       |             | - write replorigin_checkpoint file                                                               |
      |                       |             |                                                                                                  |
      |                       |             | - handle Two-phase commit                                                                        |
      |                       |             |                                                                                                  |
      |                       |             | - remove lingering files                                                                         |
      |                       |             |                                                                                                  |
      |                       |             | - recycle or remove log files                                                                    |
      |                       |             |                                                                                                  |
      |                       |             | - prealloc log files                                                                             |
      |                       |             |                                                                                                  |
      |                       |             | - truncate subtransaction segments                                                               |
      |                       |             |                                                                                                  |
      |                       |             | - skip                                                                                           |
      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
      | ``flags``             | ``text``    | 检查点的触发类型 {restartpoint\checkpoint}                                                       |
      |                       |             |                                                                                                  |
      |                       |             | starting:{shutdown\ end-of-recovery\ immediate\ force\ wait\ wal\ time \flush-all }              |
      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
      | ``buffers_scan``      | ``bigint``  | 扫描出的脏块数量。取值范围：0 - NBuffers，其中，NBuffers最大不会超过2147483647                   |
      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
      | ``buffers_processed`` | ``bigint``  | 处理过的脏块数量。取值范围：0 - NBuffers，其中，NBuffers最大不会超过2147483647                   |
      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
      | ``buffers_written``   | ``bigint``  | 写回磁盘的脏块数量。取值范围：0 - NBuffers，其中，NBuffers最大不会超过2147483647。               |
      |                       |             |                                                                                                  |
      |                       |             | 由于其他进程也可能会写回脏块，所以 ``buffer_written`` 的数量可能会比``buffer_processed``的数量小 |
      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
      | ``written_progress``  | ``text``    | 处理进度百分比，展示当前处理脏块的进度。其计算公式为：(buffers_processed/buffers_scan)*100.0     |
      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
      | ``written_rate``      | ``text``    | 检查点写脏块的速率。系统会根据速率大小会自动调整显示单位，支持的单位有：MB/s、KB/s、B/s          |
      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
      | ``start_time``        | ``text``    | 开始执行检查点的时间                                                                             |
      +-----------------------+-------------+--------------------------------------------------------------------------------------------------+
