# 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 {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `integer` | Upstream pg_settings type |
| Context | `sighup` | Takes effect after configuration reload |
| Unit | `MB` | Raw unit |
| Range | `2` – `2147483647` | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Write-Ahead Log / Checkpoints | Upstream classification |
| Latest boot value | `1024` | 1 GiB |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG9.5 |
| Present in | PG9.5–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`88e982302684`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=88e982302684246e8af785e78a467ac37c76dee9) — Replace checkpoint_segments with min_wal_size and max_wal_size. |
| Commit date | 2015-02-23 |
| Discussion | — |

## Default history {#default-history}

| 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 |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

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 {#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. |
{.full-width}

## Pigsty {#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` |
{.full-width}

> [!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 {#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.

## Related parameters {#related-parameters}

[`min_wal_size`](/parameters/min-wal-size/) · [`checkpoint_timeout`](/parameters/checkpoint-timeout/) · [`checkpoint_completion_target`](/parameters/checkpoint-completion-target/) · [`checkpoint_warning`](/parameters/checkpoint-warning/) · [`wal_keep_size`](/parameters/wal-keep-size/) · [`max_slot_wal_keep_size`](/parameters/max-slot-wal-keep-size/)

## References {#references}

- [PostgreSQL 19 Beta 3 — max_wal_size](https://www.postgresql.org/docs/19/runtime-config-wal.html#GUC-MAX-WAL-SIZE)
- [PostgreSQL 18: WAL Configuration](https://www.postgresql.org/docs/18/wal-configuration.html)
- [PostgreSQL 18: pg_stat_checkpointer](https://www.postgresql.org/docs/18/monitoring-stats.html#MONITORING-PG-STAT-CHECKPOINTER-VIEW)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
