DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Write-Ahead Log / Settings

wal_skip_threshold

Minimum size of new file to fsync instead of writing WAL.

  • Default: 2MB
  • Type: integer (kB)
  • Range: 0 … max (2147483647)
  • Applies: Session (any user)

In plain words

Only matters with wal_level = minimal. When a transaction creates or rewrites a table and commits, PostgreSQL can either copy the new data into WAL or simply force the new files to disk. Small files go into WAL (cheap); files larger than wal_skip_threshold are fsynced instead, so huge loads do not flood the WAL.

For DBAs and operators

Applies to relations created or truncated in the same transaction (CREATE TABLE … AS, COPY into a new/truncated table, CLUSTER, VACUUM FULL, CREATE INDEX) when wal_level = minimal. At commit, for each such relation smaller than the threshold the data is written to WAL as page images; larger ones are fsynced directly.

Trade-off: WAL-logging small relations avoids many tiny fsyncs; fsyncing big ones avoids writing the data twice. Very large fsyncs at commit can slow concurrent transactions; depending on the storage, raising or lowering the threshold may help. Default 2 MB. Irrelevant at replica or logical, where everything is WAL-logged anyway.

How to change it

Any user can change it for their session with SET.

See it in context

Write-ahead log (WAL)

Related parameters

wal_level fsync

All Write-Ahead Log parameters