Parameter · Write-Ahead Log / Recovery
wal_decode_buffer_size
Buffer size for reading ahead in the WAL during recovery. Maximum distance to read ahead in the WAL to prefetch referenced data blocks.
- Default:
512kB - Type: integer (B)
- Range: 64kB … 1024MB
- Applies: Restart required
In plain words
When recovery prefetching is enabled, PostgreSQL decodes WAL a bit ahead of where it is replaying. wal_decode_buffer_size limits how far ahead. A larger window gives disk reads more time to finish before replay needs the page.
For DBAs and operators
Default 512 kB, set at server start. It caps the distance in bytes; the real look-ahead is also limited by maintenance_io_concurrency (number of concurrent prefetches). Check wal_distance and io_depth in pg_stat_recovery_prefetch: if io_depth stays below maintenance_io_concurrency while wal_distance is at the limit, a larger buffer can help. Has no effect when recovery_prefetch = off.
How to change it
Change in postgresql.conf or ALTER SYSTEM, then restart the server.