Skip to content

bgwriter_delay

bgwriter_delay — Background writer sleep time between rounds. Observed in PG9.0–19 Beta 3; its last measured boot default is 200 ms in PG19 Beta 3, with sighup context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
Note

Fact — official short description: “Background writer sleep time between rounds.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuesighup
Takes effect after configuration reload
Unit , Valuems
Raw unit
Range , Value1010000
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueResource Usage / Background Writer
Upstream classification
Latest boot value , Value200
200 ms

Lifecycle

Fact Value
First observed PG9.0 (research boundary)
Present in PG9.0–19 Beta 3
Removed in No
Introduction commit Not asserted: predates the PG9.0 research boundary
Commit date
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.0–19 Beta 3 200 ms 200 ms

How it works

The background writer performs a round, writes selected dirty shared buffers, then sleeps for bgwriter_delay. When no dirty buffers are found it can enter a longer sleep regardless of this value.

A shorter interval reacts sooner to buffer demand but wakes the process more often. Effective timer granularity can be about 10 ms on some systems, so smaller or non-multiple values may round up in practice.

The number of pages considered per round is derived from recent buffer allocation demand, bgwriter_lru_multiplier, and bgwriter_lru_maxpages; checkpoints are handled separately. Its SIGHUP context allows configuration reload without a server restart.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Tune bgwriter_delay only with bgwriter and checkpoint metrics. The goal is fewer backend writes and smoother latency without excessive repeated writes; change one dimension at a time.
OLAP Bulk writes can reach bgwriter_delay limits continuously. Measure total bytes written, checkpoints, and storage queueing, not just foreground query latency.
Small nodes A small host usually needs conservative write smoothing. Aggressive bgwriter_delay can consume I/O needed by foreground work, so retain the default unless backend writes are a measured problem.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP 10ms different 10ms
OLAP 10ms different 10ms
CRIT 10ms different 10ms
TINY 10ms different 10ms
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 = 10ms (dcs); OLAP: PG9.0–19 Beta 3 = 10ms (dcs); CRIT: PG9.0–19 Beta 3 = 10ms (dcs); TINY: PG9.0–19 Beta 3 = 10ms (dcs). Advice, pending human review — Editorial inference, pending maintainer review: The 10ms interval is intended to make the background writer inspect dirty-buffer demand much more frequently than PostgreSQL’s boot default.

Common pitfalls

  • Changing bgwriter_delay without applying its documented unit and configuration context.
  • Optimizing an isolated benchmark while ignoring concurrent aggregate resource use.
  • Assuming a configured value guarantees operating-system or storage behavior.
  • Failing to retest startup, failover, and workload latency after the change.

bgwriter_lru_maxpages · bgwriter_lru_multiplier · bgwriter_flush_after · shared_buffers · checkpoint_completion_target

References