WAL & checkpointsSuperuser · per sessiondefault off

wal_compression

Compresses full-page writes written in WAL file with specified method.

How you change it

Superuser · per session

Defaults and ranges on this page were read from pg_settings on live PostgreSQL 18.4. Treat older majors as needing their own check before you copy a value.

What this means

Compresses full-page images written to WAL (the full copies of pages taken on their first change after a checkpoint). It trades a little CPU for less WAL volume, which also speeds up archiving and replication on write-heavy systems.

When it matters

Turn on (pglz or a faster method like lz4/zstd where available) on write-heavy systems with WAL/network pressure.

Defaultoff
Allowedpglz, lz4, zstd, on, off
Typeenum
Change scopeSuperuser · per session
CategoryWAL & checkpoints
Check the current value
SHOW wal_compression;

Tradeoffs

  • Costs some CPU to compress each full-page image.
  • Reduces WAL size, archive bandwidth, and replication traffic.
  • Biggest wins right after checkpoints, when full-page images dominate WAL.
PostgreSQL manual: wal_compression

← All GUCs · Glossary · Runbooks