Skip to content

wal_decode_buffer_size

wal_decode_buffer_size sets the buffer size for reading ahead in the WAL during recovery. It is a postmaster setting present in PG15–18; the latest recorded boot default is 512 KiB.
Note

Fact — official short description: “Buffer size for reading ahead in the WAL during recovery.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuepostmaster
Requires a server restart
Unit , ValueB
Raw unit
Range , Value655361073741823
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueWrite-Ahead Log / Recovery
Upstream classification
Latest boot value , Value524288
512 KiB

Lifecycle

Fact Value
First observed PG15
Present in PG15–19 Beta 3
Removed in No
Introduction commit 1d257577e08d — Optionally prefetch referenced data in recovery.
Commit date 2021-04-08
Discussion thread 1

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG15–19 Beta 3 524288 B 512 KiB

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.

Tuning advice

Tip

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

Workload Guidance
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.
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.
Small nodes 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.

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 Unmodified
OLAP Unmodified
CRIT Unmodified
TINY Unmodified
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG15–19 Beta 3 unmodified; OLAP: PG15–19 Beta 3 unmodified; CRIT: PG15–19 Beta 3 unmodified; TINY: PG15–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

Common pitfalls

  • 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.

recovery_prefetch · maintenance_io_concurrency · effective_io_concurrency · shared_buffers · archive_cleanup_command · archive_command

References