Up to PostgreSQL 16 checkpointer related statistics are available in pg_stat_bgwriter. As the work of bgwriter and checkpointer has been split into two separate processes back in 2011 for PostgreSQL 9.2 (see 806a2aee3791), it makes sense to split the statistics related to those background processes as well. This has now happened for PostgreSQL 17.
Up to PostgreSQL 16 the pg_stat_bgwriter catalog view contains these fields:
postgres=# select version();
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 16.0 on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
(1 row)
postgres=# \d pg_stat_bgwriter
View "pg_catalog.pg_stat_bgwriter"
Column | Type | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
checkpoints_timed | bigint | | |
checkpoints_req | bigint | | |
checkpoint_write_time | double precision | | |
checkpoint_sync_time | double precision | | |
buffers_checkpoint | bigint | | |
buffers_clean | bigint | | |
maxwritten_clean | bigint | | |
buffers_backend | bigint | | |
buffers_backend_fsync | bigint | | |
buffers_alloc | bigint | | |
stats_reset | timestamp with time zone | | |
postgres=#
Starting with PostgreSQL 17 this view looks much simpler and all checkpointer related columns have been removed:
postgres=# select version();
version
--------------------------------------------------------------------
PostgreSQL 17devel on x86_64-linux, compiled by gcc-12.2.0, 64-bit
(1 row)
postgres=# \d pg_stat_bgwriter
View "pg_catalog.pg_stat_bgwriter"
Column | Type | Collation | Nullable | Default
------------------+--------------------------+-----------+----------+---------
buffers_clean | bigint | | |
maxwritten_clean | bigint | | |
buffers_alloc | bigint | | |
stats_reset | timestamp with time zone | | |
All those columns can now be found in pg_stat_checkpointer:
postgres=# select version();
version
--------------------------------------------------------------------
PostgreSQL 17devel on x86_64-linux, compiled by gcc-12.2.0, 64-bit
(1 row)
postgres=# \d pg_stat_checkpointer
View "pg_catalog.pg_stat_checkpointer"
Column | Type | Collation | Nullable | Default
-----------------+--------------------------+-----------+----------+---------
num_timed | bigint | | |
num_requested | bigint | | |
write_time | double precision | | |
sync_time | double precision | | |
buffers_written | bigint | | |
stats_reset | timestamp with time zone | | |
Looks much cleaner like this, one statistic view per process.
Oleg
30.09.2024Much cleaner :) This view was used for bgwriter tuning :))
buffers_backend/(buffers_checkpoint + buffers_clean + buffers_backend)