select open change scope Open full search

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

CONFIGURATION / WRITE-AHEAD LOG

As long as WAL disk usage stays below this setting, old WAL files are always recycled for future use at a checkpoint, rather than removed.

Type
integer
Context
sighup
Measured default
80 MiB
Unit
MB
Metadata snapshot
18

Definition PG 18 manual

As long as WAL disk usage stays below this setting, old WAL files are always recycled for future use at a checkpoint, rather than removed. This can be used to ensure that enough WAL space is reserved to handle spikes in WAL usage, for example when running large batch jobs. If this value is specified without units, it is taken as megabytes. The default is 80 MB. This parameter can only be set in the postgresql.conf file or on the server command line.

Measured default history
Version intervalDefault
9.5 – 9.680 MiB (5 × 16MB)
10 – 1980 MiB
Analysis & operational context

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

How it works

Sets the minimum size to shrink the WAL to. A configuration reload applies a new value; existing work already in flight is not retroactively changed.

Below this floor, checkpoint recycling keeps old segment files ready for reuse instead of removing them. It is a retained/recycled space floor, not a cap; archive failures, replication slots, wal_keep_size, and max_wal_size can all make pg_wal much larger.

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

Operational considerations

Reading it as a maximum pg_wal size.

Sizing it without wal_segment_size rounding and burst rate.

Ignoring archive/slot retention that can exceed both min_wal_size and max_wal_size.

Confusing pg_settings base units with human-readable configuration units.

Benchmarking throughput without a crash-recovery and archive-restore test.

Workload guidance

OLAP: Large batch loads may benefit from a bigger reusable pool, but derive it from repeatable batch peaks rather than copying an arbitrary GB value; archive and slot retention are separate.

OLTP: Size the recycled-segment floor from ordinary WAL generated between checkpoints and measured file-creation cost. Keep it well below available pg_wal space and evaluate it together with max_wal_size.

SMALL: It is not free on a small volume; lowering it trades space for more segment create/remove churn.

Version history 3
  1. PG 11 → 12changed
  2. PG 9.6 → 10changed
  3. PG 9.4 → 9.5added

Related entries

Further reading

Definition snapshot: english-manuals:f544c1b9ecb505b2dedbede6be9… · English manual source