DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Write-Ahead Log / Settings

wal_recycle

Recycles WAL files by renaming them.

  • Default: on
  • Type: bool
  • Applies: Session (superuser)

In plain words

Old WAL files that are no longer needed are normally renamed and reused as future segments, which avoids creating new 16 MB files. On copy-on-write file systems creating fresh files can be faster, so wal_recycle = off deletes them instead.

For DBAs and operators

At the end of each checkpoint (or restartpoint on a standby) segments older than the redo point, and not held back by slots, wal_keep_size or archiving, are either recycled (renamed to a future segment name) or removed. How many are kept for recycling depends on min_wal_size, max_wal_size and the recent WAL rate. The checkpoint log line reports both: … 0 WAL file(s) added, 3 removed, 12 recycled; …

With off, all such segments are unlinked and new ones are created (zero-filled unless wal_init_zero = off). Recommended together with wal_init_zero = off on ZFS/Btrfs only.

How to change it

A superuser (or a role granted SET) can change it per session with SET.

See it in context

Write-ahead log (WAL) Checkpoints Checkpointer

Related parameters

wal_init_zero min_wal_size max_wal_size

All Write-Ahead Log parameters