Background Writer (bgwriter) (PostgreSQL)


Jump to: navigation, search

Bgwriter (background writer) pushes buffers to disk. Backend processes handling queries never have to wait for a write to occur as bgwriter will do it first.



bgwriter_delay: Specifiys how often bgwrite will run. brwriter_lru_maxpages: Sets the maximum number of buffers that may be flushed to disk in each run. When a buffer is not flushed due to the maximum pages value being hit the maxwritten_clean value in pg_stat_bgwriter is incremented. bgwriter_lru_multiplier: Number of buffers that can be flushed on-demand due to a new backend process (query), this value is brwriter_lru_maxpages * bgwriter_lru_multiplier .

See Also


In PGSQL 8.4 bgwriter and checkpoint is part of the same process - checkpoint stats are also here

checkpoints_timed: CPs that have occured due to checkpoint_timeout checkpoints_req: Flushing of buffers due to checkpoint_segments and relatively one-off requirements such as when running a drop database command. maxwritten_clean: bgwriter did not run due to brwriter_lru_maxpages buffers_backend: Flushing of buffers due a new backend process (query).

A snapshot can be run with select *,now() from pg_stat_bgwriter;

See Also

Personal tools