Configuration parameter

wal_writer_delay — PostgreSQL configuration parameter

Category Write Ahead Log Default 200 milliseconds (200ms Change scope Sighup

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

At a glance

Property Value
Parameter wal_writer_delay
Category Write Ahead Log
Default 200
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 time terms. After flushing WAL the writer sleeps for the length of time given by wal_writer_delay, unless woken up sooner by an asynchronously committing transaction. 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 this value is specified without units, it is taken as milliseconds. The default value is 200 milliseconds (200ms). Note that on some systems, the effective resolution of sleep delays is 10 milliseconds; setting wal_writer_delay to a value that is not a multiple of 10 might have the same results as setting it to the next higher multiple of 10. 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_delay; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'wal_writer_delay';.

Tuning guidance

Lower it for tighter WAL flush latency under synchronous_commit = off; raise it to batch more aggressively. It interacts with wal_writer_flush_after and only matters for async commit.

Reference

PostgreSQL documentation — wal_writer_delay.

Keep going

Related & next steps

Concepts on this page

Was this helpful?

← All configuration parameters