Skip to content

wal_compression

wal_compression — Compresses full-page writes written in WAL file with specified method. Observed in PG9.5–19 Beta 3; its last measured boot default is off in PG19 Beta 3, with superuser context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA.
Note

Fact — official short description: “Compresses full-page writes written in WAL file with specified method.”

Identity

Type , Valueenum
Upstream pg_settings type
Context , Valuesuperuser
Settable at runtime by a superuser
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Valuepglz, lz4, zstd, on, off
— for non-enum types
Category , ValueWrite-Ahead Log / Settings
Upstream classification
Latest boot value , Valueoff
off

Lifecycle

Fact Value
First observed PG9.5
Present in PG9.5–19 Beta 3
Removed in No
Introduction commit 57aa5b2bb11a — Add GUC to enable compression of full page images stored in WAL.
Commit date 2015-03-11
Discussion

Default history

Measured PG9.0–19 Beta 3 boot defaults
Versions Raw boot_val Unit Human value
PG9.5–19 Beta 3 off off

How it works

Compresses full-page writes written in WAL file with specified method. A superuser or a role granted SET privilege can change it for the relevant session or configuration scope.

Compression applies to full-page images produced by full_page_writes, backup, or hint logging, not to every WAL record. pglz is built in; lz4/zstd availability depends on the build, and replay pays decompression CPU in exchange for lower WAL volume.

Monitor and change wal_compression together with full_page_writes, wal_log_hints, wal_level. Validate on the relevant server role and real workload, then use its superuser context to choose session change, reload, or restart; a historical boot default is not the current effective value.

Tuning advice

Tip

Advice. These are workload-specific starting points and must be validated with measurements.

Workload Guidance
OLTP Establish durability and recovery objectives first, then tune wal_compression from WAL rate, flush latency, checkpoints, and peak pg_wal usage. Validate every change with crash/recovery and archive monitoring.
OLAP Provision WAL, archive bandwidth, and recovery I/O for bulk-load peaks. Coordinate load pacing and checkpoints when reducing spikes; never break the recovery chain for throughput.
Small nodes Start from safe defaults or the measured Pigsty value and set explicit alerts for limited disk capacity. Do not disable durability or break the recovery chain merely to save modest I/O.

Pigsty

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

Template Effective value Versus upstream boot Source expression
OLTP lz4 different lz4
OLAP lz4 different lz4
CRIT lz4 different lz4
TINY lz4 different lz4
Caution

Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.5–14 unmodified, PG15–19 Beta 3 = lz4 (dcs); OLAP: PG9.5–14 unmodified, PG15–19 Beta 3 = lz4 (dcs); CRIT: PG9.5–14 unmodified, PG15–19 Beta 3 = lz4 (dcs); TINY: PG9.5–14 unmodified, PG15–19 Beta 3 = lz4 (dcs). Advice, pending human review — Editorial interpretation, pending human maintainer review: the override appears intended to reduce full-page-image WAL volume with LZ4 on releases that support the enum method; confirm it against the current Pigsty templates, hardware fixture, and operational guarantees before publication.

Common pitfalls

  • Expecting compression to affect every WAL record rather than full-page images.
  • Selecting lz4 or zstd on a server build that does not provide that method.
  • Ignoring compression CPU on the primary and decompression CPU during replay.
  • Changing a privileged session value and assuming other sessions or future connections inherited it.
  • Comparing WAL bytes without controlling checkpoint frequency and full_page_writes activity.

full_page_writes · wal_log_hints · wal_level · wal_buffers · commit_delay · commit_siblings

References