aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-10-30 09:47:16 +0900
committerMichael Paquier <michael@paquier.xyz>2023-10-30 09:47:16 +0900
commit96f052613f35d07d001c8dd2f284ca8d95f82d1b (patch)
tree5a685b8ab234dda0862c915fd4526f39f09c9d39 /src/include
parentbf01e1ba963aed17449c70fed03c4ae74cce3926 (diff)
downloadpostgresql-96f052613f35d07d001c8dd2f284ca8d95f82d1b.tar.gz
postgresql-96f052613f35d07d001c8dd2f284ca8d95f82d1b.zip
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 806a2aee3791 and bf405ba8e460. 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
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h2
-rw-r--r--src/include/catalog/pg_proc.dat30
-rw-r--r--src/include/pgstat.h11
3 files changed, 24 insertions, 19 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index d75acb3b089..bee21befdab 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -57,6 +57,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202310271
+#define CATALOG_VERSION_NO 202310301
#endif
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index bc41e926776..568aa80d922 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -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' },
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index e6fd20f1ce2..f95d8db0c4c 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -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;