wal_writer_flush_after
Fact — official short description: “Amount of WAL written out by WAL writer that triggers a flush.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG9.6 |
| Present in | PG9.6–19 Beta 3 |
| Removed in | No |
| Introduction commit | 7975c5e0a992 — Allow the WAL writer to flush WAL at a reduced rate. |
| Commit date | 2016-02-15 |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.6–19 Beta 3 | 128 |
8kB |
1 MiB (128 × 8kB) |
How it works
Amount of WAL written out by WAL writer that triggers a flush. A configuration reload applies a new value; existing work already in flight is not retroactively changed.
After this volume since its last flush, the WAL writer forces written WAL to durable storage; otherwise it may only write to the OS. Zero flushes immediately, while larger values trade background smoothing against a bigger dirty-WAL window for asynchronous commits.
Monitor and change wal_writer_flush_after together with wal_buffers, wal_writer_delay, wal_sync_method. Validate on the relevant server role and real workload, then use its sighup context to choose session change, reload, or restart; a historical boot default is not the current effective value.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Establish durability and recovery objectives first, then tune wal_writer_flush_after from WAL rate, flush latency, checkpoints, and peak pg_wal usage. Validate every change with crash/recovery and archive monitoring. |
| OLAP | Provision WAL, archive bandwidth, and recovery I/O for bulk-load peaks. Coordinate load pacing and checkpoints when reducing spikes; never break the recovery chain for throughput. |
| Small nodes | Start from safe defaults or the measured Pigsty value and set explicit alerts for limited disk capacity. Do not disable durability or break the recovery chain merely to save modest I/O. |
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 | 1MB |
same as boot | 1MB |
| OLAP | 1MB |
same as boot | 1MB |
| CRIT | 0 |
different | 0 |
| TINY | 1MB |
same as boot | 1MB |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.6–19 Beta 3 = 1MB (dcs); OLAP: PG9.6–19 Beta 3 = 1MB (dcs); CRIT: PG9.6–19 Beta 3 = 0 (dcs); TINY: PG9.6–19 Beta 3 = 1MB (dcs). Advice, pending human review — Editorial interpretation, pending human maintainer review: the override appears intended to flush WAL writer output in 1 MiB batches, while CRIT requests immediate flushes; confirm it against the current Pigsty templates, hardware fixture, and operational guarantees before publication.
Common pitfalls
- Reading an unqualified value as bytes rather than WAL blocks.
- Forgetting that zero requests an immediate flush from the WAL writer.
- Choosing a large batch without considering asynchronous-commit loss exposure and dirty WAL.
- Treating the setting as a replacement for synchronous commit flushes.
- Tuning it without wal_writer_delay and storage flush latency.
Related parameters
wal_buffers · wal_writer_delay · wal_sync_method · synchronous_commit · commit_delay · commit_siblings
References
- PostgreSQL 19 Beta 3 — wal_writer_flush_after
- PostgreSQL 19 release notes
- Machine-readable GUC export