DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Write-Ahead Log / Settings

wal_writer_flush_after

Amount of WAL written out by WAL writer that triggers a flush.

  • Default: 1MB
  • Type: integer (8kB)
  • Range: 0 … max (2147483647)
  • Applies: Reload

In plain words

The WAL writer writes WAL out regularly. Writing to the operating system is cheap; forcing it to disk (flushing) is expensive. wal_writer_flush_after lets it write without flushing until this much WAL has piled up (or wal_writer_delay has passed since the last flush).

For DBAs and operators

Rule used by the WAL writer each round: if the last flush was less than wal_writer_delay ago and less than wal_writer_flush_after of WAL has been written since, only write(); otherwise flush. 0 means flush every time. Default 128 × 8 kB = 1 MB.

This only affects the background WAL writer. Synchronous commits always flush their own WAL. Raising it can reduce fsync count on servers with many asynchronous commits; lowering it shortens the data-at-risk window for synchronous_commit = off. Defaults are fine for most systems.

How to change it

Change in postgresql.conf or ALTER SYSTEM, then run SELECT pg_reload_conf().

See it in context

WAL writer Write-ahead log (WAL)

Related parameters

wal_writer_delay synchronous_commit checkpoint_flush_after

All Write-Ahead Log parameters