The benefit of lz4 and zstd for Postgres WAL compression
In 2020 I published benchmark results to understand the impact of DBMS tuning options for the insert benchmark with MySQL and Postgres ( here and here ). One of the results was that wal_compression = pglz used more CPU than expected. I asked aloud whether support for lz4 would help. Well, the Postgres community has delivered and either lz4 or zstd can be used in place of pglz in the upcoming Postgres version 15. Docs are here . Support for lz4 to compress TOAST was added in version 14. tl;dr - wal_compression=lz4 or =zstd are a big improvement over =pglz Details Postgres optionally writes page images (the pre-image) to the WAL the first time a page is to be written back after a checkpoint. This provides protection from torn-page writes. InnoDB solves this via the doublewrite buffer . An LSM like RocksDB doesn't modify previously written database pages so it doesn't have something similar. Writing pages to the redo log increases the frequency at which log files must be rotated