Home Explore Blog CI



postgresql

39th chunk of `doc/src/sgml/monitoring.sgml`
df41418ec967721d38e8f44ce33636a7caaa9605be15d2db0000000100000fa5
 disk,
       in milliseconds
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>sync_time</structfield> <type>double precision</type>
      </para>
      <para>
       Total amount of time that has been spent in the portion of
       processing checkpoints and restartpoints where files are synchronized to
       disk, in milliseconds
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>buffers_written</structfield> <type>bigint</type>
      </para>
      <para>
       Number of shared buffers written during checkpoints and restartpoints
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
        <structfield>slru_written</structfield> <type>bigint</type>
      </para>
      <para>
        Number of SLRU buffers written during checkpoints and restartpoints
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>stats_reset</structfield> <type>timestamp with time zone</type>
      </para>
      <para>
       Time at which these statistics were last reset
      </para></entry>
     </row>
    </tbody>
   </tgroup>
  </table>

  <para>
   Checkpoints may be skipped if the server has been idle since the last one.
   <structfield>num_timed</structfield> and
   <structfield>num_requested</structfield> count both completed and skipped
   checkpoints, while <structfield>num_done</structfield> tracks only
   the completed ones.  Similarly, restartpoints may be skipped
   if the last replayed checkpoint record is already the last restartpoint.
   <structfield>restartpoints_timed</structfield> and
   <structfield>restartpoints_req</structfield> count both completed and
   skipped restartpoints, while <structfield>restartpoints_done</structfield>
   tracks only the completed ones.
  </para>
 </sect2>

 <sect2 id="monitoring-pg-stat-wal-view">
   <title><structname>pg_stat_wal</structname></title>

  <indexterm>
   <primary>pg_stat_wal</primary>
  </indexterm>

  <para>
   The <structname>pg_stat_wal</structname> view will always have a
   single row, containing data about WAL activity of the cluster.
  </para>

  <table id="pg-stat-wal-view" xreflabel="pg_stat_wal">
   <title><structname>pg_stat_wal</structname> View</title>
   <tgroup cols="1">
    <thead>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       Column Type
      </para>
      <para>
       Description
      </para></entry>
     </row>
    </thead>

    <tbody>
     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>wal_records</structfield> <type>bigint</type>
      </para>
      <para>
       Total number of WAL records generated
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>wal_fpi</structfield> <type>bigint</type>
      </para>
      <para>
       Total number of WAL full page images generated
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>wal_bytes</structfield> <type>numeric</type>
      </para>
      <para>
       Total amount of WAL generated in bytes
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>wal_buffers_full</structfield> <type>bigint</type>
      </para>
      <para>
       Number of times WAL data was written to disk because WAL buffers became full
      </para></entry>
     </row>

     <row>
      <entry role="catalog_table_entry"><para role="column_definition">
       <structfield>stats_reset</structfield> <type>timestamp with time zone</type>
      </para>
      <para>
       Time at which these

Title: pg_stat_checkpointer and pg_stat_wal Views: Monitoring Checkpoints, Restartpoints, and WAL Activity
Summary
This section details the `pg_stat_checkpointer` and `pg_stat_wal` views in PostgreSQL. It explains that `pg_stat_checkpointer` provides statistics about the checkpointer process, tracking the number of scheduled, requested, and completed checkpoints and restartpoints, along with the time spent writing and syncing files to disk, and the number of buffers written. The view also notes that checkpoints and restartpoints can be skipped when the server is idle. The section then introduces the `pg_stat_wal` view, which contains WAL activity data, including the number of WAL records and full page images generated, the total amount of WAL generated in bytes, and the number of times WAL data was written to disk due to full WAL buffers. Both views also include a `stats_reset` field indicating the last time the statistics were reset.