select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / WRITE-AHEAD LOG

If set to on (the default), this option causes WAL files to be recycled by renaming them, avoiding the need to create new ones.

Type
bool
Context
superuser
Measured default
on
Unit
Metadata snapshot
18

Definition PG 18 manual

If set to on (the default), this option causes WAL files to be recycled by renaming them, avoiding the need to create new ones. On COW file systems, it may be faster to create new ones, so the option is given to disable this behavior.

Measured default history
Version intervalDefault
12 – 19on
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

How it works

Recycles WAL files by renaming them. A superuser or a role granted SET privilege can change it for the relevant session or configuration scope.

With on, PostgreSQL renames no-longer-needed WAL segments for future use rather than creating new files. Reuse is usually cheaper, but on copy-on-write storage fresh allocation can perform better and avoid preserving extents.

Monitor and change wal_recycle together with wal_init_zero, wal_segment_size, min_wal_size. Validate on the relevant server role and real workload, then use its superuser context to choose session change, reload, or restart; a historical boot default is not the current effective value.

Operational considerations

Assuming recycled renames are always faster than new allocation on copy-on-write storage.

Disabling recycling without measuring segment creation latency during WAL bursts.

Expecting a session change to alter files already recycled or removed.

Treating recycling as a WAL retention limit rather than a file-reuse policy.

Workload guidance

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.

OLTP: Establish durability and recovery objectives first, then tune wal_recycle from WAL rate, flush latency, checkpoints, and peak pg_wal usage. Validate every change with crash/recovery and archive monitoring.

SMALL: Start from safe defaults and set explicit alerts for limited disk capacity. Do not disable durability or break the recovery chain merely to save modest I/O.

Version history 1
  1. PG 11 → 12added

Related entries

Further reading

Definition snapshot: english-manuals:022be4f44e5c5c25c5d9af6e62e… · English manual source