bgwriter_lru_multiplier
Fact — official short description: “Multiple of the average buffer usage to free per round.”
Identity
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
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.0–19 Beta 3 | 2 |
— | 2 |
How it works
The background writer averages recent buffer allocations and multiplies that demand by bgwriter_lru_multiplier to choose a target number of clean reusable buffers. A value above 1 adds cushion for bursts.
This is a forecast multiplier, not a direct number of pages. Actual writes remain capped by bgwriter_lru_maxpages and occur once per bgwriter_delay round.
More cushion can reduce foreground backend writes and latency spikes, but pages dirtied repeatedly between checkpoints may be written more times, increasing total I/O. Its SIGHUP context allows configuration reload without a server restart.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Tune bgwriter_lru_multiplier 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_lru_multiplier 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_lru_multiplier 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 | 5.0 |
different | 5.0 |
| OLAP | 5.0 |
different | 5.0 |
| CRIT | 5.0 |
different | 5.0 |
| TINY | 5.0 |
different | 5.0 |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 = 5.0 (dcs); OLAP: PG9.0–19 Beta 3 = 5.0 (dcs); CRIT: PG9.0–19 Beta 3 = 5.0 (dcs); TINY: PG9.0–19 Beta 3 = 5.0 (dcs). Advice, pending human review — Editorial inference, pending maintainer review: The larger forecast cushion is intended to absorb bursts in buffer demand, accepting possible extra background writes.
Common pitfalls
- Changing bgwriter_lru_multiplier 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.
Related parameters
bgwriter_lru_maxpages · bgwriter_delay · bgwriter_flush_after · shared_buffers · checkpoint_completion_target
References
- PostgreSQL 19 Beta 3 — bgwriter_lru_multiplier
- PostgreSQL 19 release notes
- Machine-readable GUC export