1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-11 00:12:06 +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

@@ -57,6 +57,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 202310271
#define CATALOG_VERSION_NO 202310301
#endif

View File

@@ -5700,20 +5700,24 @@
proargnames => '{archived_count,last_archived_wal,last_archived_time,failed_count,last_failed_wal,last_failed_time,stats_reset}',
prosrc => 'pg_stat_get_archiver' },
{ oid => '2769',
descr => 'statistics: number of timed checkpoints started by the bgwriter',
proname => 'pg_stat_get_bgwriter_timed_checkpoints', provolatile => 's',
descr => 'statistics: number of timed checkpoints started by the checkpointer',
proname => 'pg_stat_get_checkpointer_num_timed', provolatile => 's',
proparallel => 'r', prorettype => 'int8', proargtypes => '',
prosrc => 'pg_stat_get_bgwriter_timed_checkpoints' },
prosrc => 'pg_stat_get_checkpointer_num_timed' },
{ oid => '2770',
descr => 'statistics: number of backend requested checkpoints started by the bgwriter',
proname => 'pg_stat_get_bgwriter_requested_checkpoints', provolatile => 's',
descr => 'statistics: number of backend requested checkpoints started by the checkpointer',
proname => 'pg_stat_get_checkpointer_num_requested', provolatile => 's',
proparallel => 'r', prorettype => 'int8', proargtypes => '',
prosrc => 'pg_stat_get_bgwriter_requested_checkpoints' },
prosrc => 'pg_stat_get_checkpointer_num_requested' },
{ oid => '2771',
descr => 'statistics: number of buffers written by the bgwriter during checkpoints',
proname => 'pg_stat_get_bgwriter_buf_written_checkpoints', provolatile => 's',
descr => 'statistics: number of buffers written by the checkpointer',
proname => 'pg_stat_get_checkpointer_buffers_written', provolatile => 's',
proparallel => 'r', prorettype => 'int8', proargtypes => '',
prosrc => 'pg_stat_get_bgwriter_buf_written_checkpoints' },
prosrc => 'pg_stat_get_checkpointer_buffers_written' },
{ oid => '8206', descr => 'statistics: last reset for the checkpointer',
proname => 'pg_stat_get_checkpointer_stat_reset_time', provolatile => 's',
proparallel => 'r', prorettype => 'timestamptz', proargtypes => '',
prosrc => 'pg_stat_get_checkpointer_stat_reset_time' },
{ oid => '2772',
descr => 'statistics: number of buffers written by the bgwriter for cleaning dirty buffers',
proname => 'pg_stat_get_bgwriter_buf_written_clean', provolatile => 's',
@@ -5730,14 +5734,14 @@
prosrc => 'pg_stat_get_bgwriter_stat_reset_time' },
{ oid => '3160',
descr => 'statistics: checkpoint time spent writing buffers to disk, in milliseconds',
proname => 'pg_stat_get_checkpoint_write_time', provolatile => 's',
proname => 'pg_stat_get_checkpointer_write_time', provolatile => 's',
proparallel => 'r', prorettype => 'float8', proargtypes => '',
prosrc => 'pg_stat_get_checkpoint_write_time' },
prosrc => 'pg_stat_get_checkpointer_write_time' },
{ oid => '3161',
descr => 'statistics: checkpoint time spent synchronizing buffers to disk, in milliseconds',
proname => 'pg_stat_get_checkpoint_sync_time', provolatile => 's',
proname => 'pg_stat_get_checkpointer_sync_time', provolatile => 's',
proparallel => 'r', prorettype => 'float8', proargtypes => '',
prosrc => 'pg_stat_get_checkpoint_sync_time' },
prosrc => 'pg_stat_get_checkpointer_sync_time' },
{ oid => '2859', descr => 'statistics: number of buffer allocations',
proname => 'pg_stat_get_buf_alloc', provolatile => 's', proparallel => 'r',
prorettype => 'int8', proargtypes => '', prosrc => 'pg_stat_get_buf_alloc' },

View File

@@ -260,11 +260,12 @@ typedef struct PgStat_BgWriterStats
typedef struct PgStat_CheckpointerStats
{
PgStat_Counter timed_checkpoints;
PgStat_Counter requested_checkpoints;
PgStat_Counter checkpoint_write_time; /* times in milliseconds */
PgStat_Counter checkpoint_sync_time;
PgStat_Counter buf_written_checkpoints;
PgStat_Counter num_timed;
PgStat_Counter num_requested;
PgStat_Counter write_time; /* times in milliseconds */
PgStat_Counter sync_time;
PgStat_Counter buffers_written;
TimestampTz stat_reset_timestamp;
} PgStat_CheckpointerStats;