min_wal_size
Fact — official short description: “Sets the minimum size to shrink the WAL to.”
Identity
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
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.5–9.6 | 5 |
16MB |
80 MiB (5 × 16MB) |
| PG10–19 Beta 3 | 80 |
MB |
80 MiB |
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.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| 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. |
| 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. |
| Small nodes | Verify that Pigsty’s measured 5GB matrix value fits the actual disk. It is not free on a small volume; lowering it trades space for more segment create/remove churn. |
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 | 5GB |
different | {{ ([pg_size_twentieth, 200])|min }}GB |
| OLAP | 5GB |
different | {{ ([pg_size_twentieth, 200])|min }}GB |
| CRIT | 5GB |
different | {{ ([pg_size_twentieth, 200])|min }}GB |
| TINY | 5GB |
different | {{ ([pg_size_twentieth, 200])|min }}GB |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.5–19 Beta 3 = 5GB (dcs); OLAP: PG9.5–19 Beta 3 = 5GB (dcs); CRIT: PG9.5–19 Beta 3 = 5GB (dcs); TINY: PG9.5–19 Beta 3 = 5GB (dcs). Advice, pending human review — Editorial interpretation, pending human maintainer review: the override appears intended to retain a reusable WAL pool large enough to absorb routine bursts without file churn; confirm it against the current Pigsty templates, hardware fixture, and operational guarantees before publication.
Common pitfalls
- 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.
Related parameters
max_wal_size · wal_keep_size · wal_segment_size · checkpoint_timeout · checkpoint_completion_target · checkpoint_flush_after