Summary
The pg_stat_bgwriter view will always have a single row, containing data about the background writer of the cluster.
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_stat_bgwriter statistics view exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
buffers_cleanbigint
Number of buffers written by the background writermaxwritten_cleanbigint
Number of times the background writer stopped a cleaning scan because it had written too many buffersbuffers_allocbigint
Number of buffers allocatedstats_resettimestamp with time zone
Time at which these statistics were last reset
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_stat_bgwriter.