WAL compression
PostgreSQL WAL compression optionally compresses full-page images within its write-ahead log.
The setting targets page images, not all WAL records or archived segment files. PostgreSQL 18 supports pglz, plus lz4 and zstd when compiled with the corresponding libraries. Replay decompresses the images. [1]
The REL_18_0 builder can omit an unused page hole and uses compression only when the encoded representation saves space. An image count is therefore not a byte count. [2]
Relations
- related
- full-page-write, write-ahead-log, database-checkpoint
Limitations
- Compression and decompression consume CPU during logging and replay. [1]
Citations
- PostgreSQL 18: WAL settings, hint logging and image compression
- PostgreSQL REL_18_0: xloginsert.c, page holes and XLogCompressBackupBlock
Further reading
Sources & caveats
- Scoped to PostgreSQL 18 documentation and REL_18_0 code; no measured compression ratio or performance improvement is claimed.