wal_decode_buffer_size
Read PG 18 manual ↗A limit on how far ahead the server can look in the WAL, to find blocks to prefetch.
- Type
- integer
- Context
- postmaster
- Measured default
- 512 KiB
- Unit
- B
- Metadata snapshot
- 18
Definition PG 18 manual
A limit on how far ahead the server can look in the WAL, to find blocks to prefetch. If this value is specified without units, it is taken as bytes. The default is 512kB. This parameter can only be set at server start.
Measured default history
| Version interval | Default |
|---|---|
| 15 – 19 | 512 KiB |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
Buffer size for reading ahead in the WAL during recovery. The value is fixed when the server starts, so changing it requires a restart.
Recovery scans this far ahead in decoded WAL to discover future block references for prefetch. It is a restart-time memory/lead limit, not a logical-decoding output buffer, and only helps when recovery_prefetch and the storage workload benefit.
Monitor and change wal_decode_buffer_size together with recovery_prefetch, maintenance_io_concurrency, effective_io_concurrency. Validate on the relevant server role and real workload, then use its postmaster context to choose session change, reload, or restart; a historical boot default is not the current effective value.
Operational considerations
Confusing pg_settings base units with human-readable configuration units.
Benchmarking throughput without a crash-recovery and archive-restore test.
Ignoring interactions with checkpoints, replication slots, or archive failure.
Reloading a restart-context value and assuming it became active.
Workload guidance
OLAP: Large data with slow random reads may benefit more, but excess prefetch competes with query I/O and cache. Test crash recovery and a query-serving standby separately.
OLTP: Tune wal_decode_buffer_size with recovery/standby catch-up benchmarks on production-like storage while observing replay I/O wait, cache behavior, and maintenance_io_concurrency. Keep the default without measured benefit.
SMALL: The default is usually sufficient. Do not spend scarce memory or I/O queue depth on a larger look-ahead window unless a recovery-time objective is demonstrably missed.
Version history 1
- PG 14 → 15added
Related entries
Further reading
Definition snapshot: english-manuals:9aa9fe538790f8f1d6cfad382ea… · English manual source