1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Introduce pg_stat_checkpointer

Historically, the statistics of the checkpointer have been always part
of pg_stat_bgwriter.  This commit removes a few columns from
pg_stat_bgwriter, and introduces pg_stat_checkpointer with equivalent,
renamed columns (plus a new one for the reset timestamp):
- checkpoints_timed -> num_timed
- checkpoints_req -> num_requested
- checkpoint_write_time -> write_time
- checkpoint_sync_time -> sync_time
- buffers_checkpoint -> buffers_written

The fields of PgStat_CheckpointerStats and its SQL functions are renamed
to match with the new field names, for consistency.  Note that
background writer and checkpointer have been split into two different
processes in commits 806a2aee37 and bf405ba8e4.  The pgstat
structures were already split, making this change straight-forward.

Bump catalog version.

Author: Bharath Rupireddy
Reviewed-by: Bertrand Drouvot, Andres Freund, Michael Paquier
Discussion: https://postgr.es/m/CALj2ACVxX2ii=66RypXRweZe2EsBRiPMj0aHfRfHUeXJcC7kHg@mail.gmail.com
This commit is contained in:
Michael Paquier
2023-10-30 09:47:16 +09:00
parent bf01e1ba96
commit 96f052613f
14 changed files with 215 additions and 123 deletions

View File

@ -451,6 +451,15 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
</entry>
</row>
<row>
<entry><structname>pg_stat_checkpointer</structname><indexterm><primary>pg_stat_checkpointer</primary></indexterm></entry>
<entry>One row only, showing statistics about the
checkpointer process's activity. See
<link linkend="monitoring-pg-stat-checkpointer-view">
<structname>pg_stat_checkpointer</structname></link> for details.
</entry>
</row>
<row>
<entry><structname>pg_stat_database</structname><indexterm><primary>pg_stat_database</primary></indexterm></entry>
<entry>One row per database, showing database-wide statistics. See
@ -2868,7 +2877,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage
<para>
The <structname>pg_stat_bgwriter</structname> view will always have a
single row, containing global data for the cluster.
single row, containing data about the background writer of the cluster.
</para>
<table id="pg-stat-bgwriter-view" xreflabel="pg_stat_bgwriter">
@ -2886,54 +2895,6 @@ description | Waiting for a newly initialized WAL file to reach durable storage
</thead>
<tbody>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>checkpoints_timed</structfield> <type>bigint</type>
</para>
<para>
Number of scheduled checkpoints that have been performed
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>checkpoints_req</structfield> <type>bigint</type>
</para>
<para>
Number of requested checkpoints that have been performed
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>checkpoint_write_time</structfield> <type>double precision</type>
</para>
<para>
Total amount of time that has been spent in the portion of
checkpoint processing where files are written to disk, in milliseconds
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>checkpoint_sync_time</structfield> <type>double precision</type>
</para>
<para>
Total amount of time that has been spent in the portion of
checkpoint processing where files are synchronized to disk, in
milliseconds
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>buffers_checkpoint</structfield> <type>bigint</type>
</para>
<para>
Number of buffers written during checkpoints
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>buffers_clean</structfield> <type>bigint</type>
@ -2976,6 +2937,95 @@ description | Waiting for a newly initialized WAL file to reach durable storage
</sect2>
<sect2 id="monitoring-pg-stat-checkpointer-view">
<title><structname>pg_stat_checkpointer</structname></title>
<indexterm>
<primary>pg_stat_checkpointer</primary>
</indexterm>
<para>
The <structname>pg_stat_checkpointer</structname> view will always have a
single row, containing data about the checkpointer process of the cluster.
</para>
<table id="pg-stat-checkpointer-view" xreflabel="pg_stat_checkpointer">
<title><structname>pg_stat_checkpointer</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>num_timed</structfield> <type>bigint</type>
</para>
<para>
Number of scheduled checkpoints that have been performed
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>num_requested</structfield> <type>bigint</type>
</para>
<para>
Number of requested checkpoints that have been performed
</para></entry>
</row>
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>write_time</structfield> <type>double precision</type>
</para>
<para>
Total amount of time that has been spent in the portion of
checkpoint processing where files are written to 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
checkpoint processing 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 buffers written during checkpoints
</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>
</sect2>
<sect2 id="monitoring-pg-stat-wal-view">
<title><structname>pg_stat_wal</structname></title>
@ -4669,8 +4719,10 @@ description | Waiting for a newly initialized WAL file to reach durable storage
Resets some cluster-wide statistics counters to zero, depending on the
argument. The argument can be <literal>bgwriter</literal> to reset
all the counters shown in
the <structname>pg_stat_bgwriter</structname>
view, <literal>archiver</literal> to reset all the counters shown in
the <structname>pg_stat_bgwriter</structname> view,
<literal>checkpointer</literal> to reset all the counters shown in
the <structname>pg_stat_checkpointer</structname> view,
<literal>archiver</literal> to reset all the counters shown in
the <structname>pg_stat_archiver</structname> view,
<literal>io</literal> to reset all the counters shown in the
<structname>pg_stat_io</structname> view,