Skip to content

max_wal_size

max_wal_size — Sets the WAL size that triggers a checkpoint. Observed in PG9.5–19 Beta 3; its last measured boot default is 1 GiB in PG19 Beta 3, with sighup context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
Note

Fact — official short description: “Sets the WAL size that triggers a checkpoint.”

Identity

Type , Valueinteger
Upstream pg_settings type
Context , Valuesighup
Takes effect after configuration reload
Unit , ValueMB
Raw unit
Range , Value22147483647
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueWrite-Ahead Log / Checkpoints
Upstream classification
Latest boot value , Value1024
1 GiB

Lifecycle

Fact Value
First observed PG9.5
Present in PG9.5–19 Beta 3
Removed in No
Introduction commit 88e982302684 — Replace checkpoint_segments with min_wal_size and max_wal_size.
Commit date 2015-02-23
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.5–9.6 64 16MB 1 GiB (64 × 16MB)
PG10–19 Beta 3 1024 MB 1 GiB

How it works

The checkpointer starts an automatic checkpoint when checkpoint_timeout expires or when WAL growth is about to exceed max_wal_size, whichever happens first. More frequent checkpoints write dirty buffers more often and also cause more full-page images after each checkpoint.

max_wal_size is not a disk quota. WAL can exceed it under heavy write load, during recovery, when archiving is slow or failing, when wal_keep_size retains files, or when a replication slot still needs old WAL.

A larger value usually reduces requested checkpoints and checkpoint-related write churn, but reserves a longer WAL replay horizon after a crash and requires more pg_wal headroom. min_wal_size controls the lower recycling floor; it does not turn max_wal_size into a hard ceiling.

Tuning advice

Tip

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

Workload Guidance
OLTP Size it from measured peak WAL generation and an acceptable checkpoint cadence. Watch pg_stat_checkpointer, checkpoint warnings, write latency, archive lag, and free space; raise it when requested checkpoints are persistently dominant, not merely because a generic formula says so.
OLAP Bulk loads and large maintenance jobs can generate WAL in bursts, so a larger value can avoid checkpoint storms. Confirm that pg_wal capacity and archive throughput can absorb the burst and that the longer crash-recovery window is acceptable.
Small nodes Keep a conservative bounded value on small disks. Account separately for slot retention and archive backlog, and leave emergency free space rather than assigning most of the volume to the nominal checkpoint threshold.

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 20GB different {{ ([pg_size_twentieth * 4, 2000])|min }}GB
OLAP 20GB different {{ ([pg_size_twentieth * 4, 2000])|min }}GB
CRIT 20GB different {{ ([pg_size_twentieth * 4, 2000])|min }}GB
TINY 20GB different {{ ([pg_size_twentieth * 4, 2000])|min }}GB
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.5–19 Beta 3 = 20GB (dcs); OLAP: PG9.5–19 Beta 3 = 20GB (dcs); CRIT: PG9.5–19 Beta 3 = 20GB (dcs); TINY: PG9.5–19 Beta 3 = 20GB (dcs). Advice, pending human review — confirm the operational intent against the current Pigsty templates and supported PostgreSQL versions before publication.

Common pitfalls

  • Treating max_wal_size as a hard cap on pg_wal usage.
  • Raising it to conceal a failed archiver or an abandoned replication slot.
  • Lowering it without checking full-page-image volume and checkpoint latency.
  • Ignoring that a bare numeric value is interpreted in megabytes.
  • Tuning it independently of checkpoint_timeout and checkpoint_completion_target.

min_wal_size · checkpoint_timeout · checkpoint_completion_target · checkpoint_warning · wal_keep_size · max_slot_wal_keep_size

References