Vonng / pigsty

Battery-Included PostgreSQL Distro as a Free RDS Alternative
https://pigsty.io
GNU Affero General Public License v3.0
2.97k stars 241 forks source link

Fix monitor view pg_stat_bgwriter & pg_stat_checkpoiner #421

Closed Vonng closed 4 days ago

Vonng commented 1 month ago

Create system view pg_stat_checkpointer (Bharath Rupireddy, Anton A. Melnikov, Alexander Korotkov)

Relevant columns have been removed from pg_stat_bgwriter and added to this new system view.

https://www.postgresql.org/docs/17/monitoring-stats.html#MONITORING-PG-STAT-CHECKPOINTER-VIEW

27.2.14. pg_stat_bgwriter

The pg_stat_bgwriter view will always have a single row, containing data about the background writer of the cluster.

Table 27.24. pg_stat_bgwriter View

Column TypeDescription
buffers_clean bigintNumber of buffers written by the background writer
maxwritten_clean bigintNumber of times the background writer stopped a cleaning scan because it had written too many buffers
buffers_alloc bigintNumber of buffers allocated
stats_reset timestamp with time zoneTime at which these statistics were last reset

27.2.15. pg_stat_checkpointer

The pg_stat_checkpointer view will always have a single row, containing data about the checkpointer process of the cluster.

Table 27.25. pg_stat_checkpointer View

Column TypeDescription
num_timed bigintNumber of scheduled checkpoints that have been performed
num_requested bigintNumber of requested checkpoints that have been performed
restartpoints_timed bigintNumber of scheduled restartpoints due to timeout or after a failed attempt to perform it
restartpoints_req bigintNumber of requested restartpoints
restartpoints_done bigintNumber of restartpoints that have been performed
write_time double precisionTotal amount of time that has been spent in the portion of processing checkpoints and restartpoints where files are written to disk, in milliseconds
sync_time double precisionTotal amount of time that has been spent in the portion of processing checkpoints and restartpoints where files are synchronized to disk, in milliseconds
buffers_written bigintNumber of buffers written during checkpoints and restartpoints
stats_reset timestamp with time zoneTime at which these statistics were last reset
Vonng commented 4 days ago

Resolved by https://github.com/Vonng/pg_exporter/issues/53