# wal_writer_flush_after

> wal_writer_flush_after — Amount of WAL written out by WAL writer that triggers a flush. Observed in PG9.6–19 Beta 3; its last measured boot default is 1 MiB (128 × 8kB) 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:** “Amount of WAL written out by WAL writer that triggers a flush.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `integer` | Upstream pg_settings type |
| Context | `sighup` | Takes effect after configuration reload |
| Unit | `8kB` | Raw unit |
| Range | `0` – `2147483647` | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Write-Ahead Log / Settings | Upstream classification |
| Latest boot value | `128` | 1 MiB (128 × 8kB) |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG9.6 |
| Present in | PG9.6–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`7975c5e0a992`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=7975c5e0a992ae9a45e03d145e0d37e2b5a707f5) — Allow the WAL writer to flush WAL at a reduced rate. |
| Commit date | 2016-02-15 |
| Discussion | — |

## Default history {#default-history}

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

## How it works {#mechanism}

Amount of WAL written out by WAL writer that triggers a flush. A configuration reload applies a new value; existing work already in flight is not retroactively changed.

After this volume since its last flush, the WAL writer forces written WAL to durable storage; otherwise it may only write to the OS. Zero flushes immediately, while larger values trade background smoothing against a bigger dirty-WAL window for asynchronous commits.

Monitor and change wal_writer_flush_after together with wal_buffers, wal_writer_delay, wal_sync_method. 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 {#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_writer_flush_after 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 | `1MB` | same as boot | `1MB` |
| OLAP | `1MB` | same as boot | `1MB` |
| CRIT | `0` | different | `0` |
| TINY | `1MB` | same as boot | `1MB` |
{.full-width}

> [!CAUTION]
> **Advice — pending human review.** Fact from the current Pigsty template projection: OLTP: PG9.6–19 Beta 3 = 1MB (dcs); OLAP: PG9.6–19 Beta 3 = 1MB (dcs); CRIT: PG9.6–19 Beta 3 = 0 (dcs); TINY: PG9.6–19 Beta 3 = 1MB (dcs). Advice, pending human review — Editorial interpretation, pending human maintainer review: the override appears intended to flush WAL writer output in 1 MiB batches, while CRIT requests immediate flushes; confirm it against the current Pigsty templates, hardware fixture, and operational guarantees before publication.

## Common pitfalls {#common-pitfalls}

- Reading an unqualified value as bytes rather than WAL blocks.
- Forgetting that zero requests an immediate flush from the WAL writer.
- Choosing a large batch without considering asynchronous-commit loss exposure and dirty WAL.
- Treating the setting as a replacement for synchronous commit flushes.
- Tuning it without wal_writer_delay and storage flush latency.

## Related parameters {#related-parameters}

[`wal_buffers`](/parameters/wal-buffers/) · [`wal_writer_delay`](/parameters/wal-writer-delay/) · [`wal_sync_method`](/parameters/wal-sync-method/) · [`synchronous_commit`](/parameters/synchronous-commit/) · [`commit_delay`](/parameters/commit-delay/) · [`commit_siblings`](/parameters/commit-siblings/)

## References {#references}

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