# wal_buffers

> wal_buffers — Sets the number of disk-page buffers in shared memory for WAL. Observed in PG9.0–19 Beta 3; its last measured boot default is -1 8kB in PG19 Beta 3, with postmaster context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
---

> [!NOTE]
> **Fact — official short description:** “Sets the number of disk-page buffers in shared memory for WAL.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `integer` | Upstream pg_settings type |
| Context | `postmaster` | Requires a server restart |
| Unit | `8kB` | Raw unit |
| Range | `-1` – `262143` | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Write-Ahead Log / Settings | Upstream classification |
| Latest boot value | `-1` | -1 8kB |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG9.0 (research boundary) |
| Present in | PG9.0–19 Beta 3 |
| Removed in | No |
| Introduction commit | Not asserted: predates the PG9.0 research boundary |
| Commit date | — |
| Discussion | — |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG9.0 | `8` | `8kB` | 64 KiB (8 × 8kB) |
| PG9.1–19 Beta 3 | `-1` | `8kB` | -1 8kB |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

Sets the number of disk-page buffers in shared memory for WAL. The value is fixed when the server starts, so changing it requires a restart.

The automatic -1 value chooses about 1/32 of shared_buffers, bounded below and by one WAL segment. The buffer absorbs WAL records before writes; too little can add WALWrite pressure during bursts, while oversized allocation consumes startup shared memory without replacing durable flushes.

Monitor and change wal_buffers together with fsync, full_page_writes, wal_sync_method. Validate on the relevant server role and real workload, then use its postmaster context to choose session change, reload, or restart; a historical boot default is not the current effective value.

## Tuning advice {#tuning-advice}

> [!TIP]
> **Advice.** These are workload-specific starting points and must be validated with measurements.

| Workload | Guidance |
| --- | --- |
| OLTP | Establish durability and recovery objectives first, then tune wal_buffers from WAL rate, flush latency, checkpoints, and peak pg_wal usage. Validate every change with crash/recovery and archive monitoring. |
| OLAP | Provision WAL, archive bandwidth, and recovery I/O for bulk-load peaks. Coordinate load pacing and checkpoints when reducing spikes; never break the recovery chain for throughput. |
| Small nodes | Start from safe defaults or the measured Pigsty value and set explicit alerts for limited disk capacity. Do not disable durability or break the recovery chain merely to save modest I/O. |
{.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 | `16MB` | different | `16MB` |
| OLAP | `16MB` | different | `16MB` |
| CRIT | `16MB` | different | `16MB` |
| TINY | `16MB` | different | `16MB` |
{.full-width}

> [!CAUTION]
> **Advice — pending human review.** Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 = 16MB (dcs); OLAP: PG9.0–19 Beta 3 = 16MB (dcs); CRIT: PG9.0–19 Beta 3 = 16MB (dcs); TINY: PG9.0–19 Beta 3 = 16MB (dcs). Advice, pending human review — Editorial interpretation, pending human maintainer review: the override appears intended to use the normal one-segment ceiling explicitly for burst absorption; confirm it against the current Pigsty templates, hardware fixture, and operational guarantees before publication.

## Common pitfalls {#common-pitfalls}

- Reading -1 as a negative allocation rather than automatic sizing.
- Forgetting that the automatic choice is based on shared_buffers and capped at one WAL segment.
- Reading an unqualified positive value as bytes rather than WAL blocks; very small positives are raised to the minimum.
- Allocating a large manual buffer without evidence of WALInsert/WALWrite pressure.
- Expecting more WAL buffers to replace durable flushes or improve a storage-bound WALSync path.

## Related parameters {#related-parameters}

[`fsync`](/parameters/fsync/) · [`full_page_writes`](/parameters/full-page-writes/) · [`wal_sync_method`](/parameters/wal-sync-method/) · [`synchronous_commit`](/parameters/synchronous-commit/) · [`wal_writer_delay`](/parameters/wal-writer-delay/) · [`wal_writer_flush_after`](/parameters/wal-writer-flush-after/)

## References {#references}

- [PostgreSQL 19 Beta 3 — wal_buffers](https://www.postgresql.org/docs/19/runtime-config-wal.html#GUC-WAL-BUFFERS)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
