Configuration parameter

wal_writer_flush_after — PostgreSQL configuration parameter

Category Write Ahead Log Default 1MB Change scope Sighup

Specifies how often the WAL writer flushes WAL, in volume terms.

At a glance

Property Value
Parameter wal_writer_flush_after
Category Write Ahead Log
Default 1MB
Value type integer
Change scope Reload (postgresql.conf, SIGHUP)
Available in PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12)

What it does

Specifies how often the WAL writer flushes WAL, in volume terms. If the last flush happened less than wal_writer_delay ago and less than wal_writer_flush_after worth of WAL has been produced since, then WAL is only written to the operating system, not flushed to disk. If wal_writer_flush_after is set to 0 then WAL data is always flushed immediately. If this value is specified without units, it is taken as WAL blocks, that is XLOG_BLCKSZ bytes, typically 8kB. The default is 1MB. This parameter can only be set in the postgresql.conf file or on the server command line.

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Set it in postgresql.conf (or with ALTER SYSTEM) and reload with SELECT pg_reload_conf(); or pg_ctl reload — no restart needed.

Inspect the current value and source with SHOW wal_writer_flush_after; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'wal_writer_flush_after';.

Tuning guidance

Tune the amount of WAL the writer buffers before forcing a flush; larger values batch more (better throughput, weaker durability window under async commit). Leave default unless chasing a specific WAL I/O pattern.

Reference

PostgreSQL documentation — wal_writer_flush_after.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters