pg_stat_bgwriter — PostgreSQL statistics view

The PostgreSQL pg_stat_bgwriter statistics view: full column reference (names, types, descriptions), catalog relationships and version support.

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_clean bigint
    Number of buffers written by the background writer
  • maxwritten_clean bigint
    Number of times the background writer stopped a cleaning scan because it had written too many buffers
  • buffers_alloc bigint
    Number of buffers allocated
  • stats_reset timestamp 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.