pgsql: Change wal_compression=on to the first of zstd, lz4, pglz
Change wal_compression=on to the first of zstd, lz4, pglz
Previously, wal_compression=on was an alias for pglz, with the
assumption that users could make an informed choice to pick a better
option. But in practice, users rarely got to that second step.
Many users don't want to be choosing algorithms - they just want WAL
compression, and expect that to work well. The configuration parameter
is set by administrators, who do not control the workload, and so are
not in a position to evaluate the options anyway. Some users may not
even realize there are other options, as previously "on" was the only
choice available.
This change maps "on" to non-pglz options, supported by the build. Both
lz4 and zstd are faster, with a comparable (or better) compression
ratio. We prefer zstd over lz4 - per our testing the better compression
ratio pays for the lower (de)compression speed.
Like for TOAST compression, the value depends on algorithms supported by
the PostgreSQL build, with lz4 and zstd being optional. But most builds
will have at least one of these external libraries. If neither zstd or
lz4 is supported, we fallback to pglz.
This only affects what "on" means. Users can still make the informed
choice and explicitly select a compression algorithm if it works better
for their system. The default value for "wal_compression" remains "off."
Initial proposal and patch by wenhui qiu, reviews and patch adjustments
by Christoph Berg. A number of other people participated in the
discussion. Benchmarks by me.
Backpatch to 19.
Author: wenhui qiu <qiuwenhuifx@gmail.com>
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: /messages/by-id/CAGjGUAL1b=Mwd1SCvLbo+fivEr9KDpFcu4jmqKCZXwT=6CiiGQ@mail.gmail.com
Backpatch-through: 19
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/5838806ce696dd0759c5e4b87754e802612135e0
Modified Files
--------------
doc/src/sgml/config.sgml | 12 ++++++------
src/backend/utils/misc/guc_tables.c | 8 ++++----
src/backend/utils/misc/postgresql.conf.sample | 3 ++-
src/include/access/xlog.h | 13 +++++++++++++
4 files changed, 25 insertions(+), 11 deletions(-)
Tomas Vondra <tomas.vondra@postgresql.org> writes:
Initial proposal and patch by wenhui qiu, reviews and patch adjustments
by Christoph Berg. A number of other people participated in the
discussion. Benchmarks by me.
Backpatch to 19.
[ raised eyebrow... ] I don't object to this change in master,
but it seems pretty out of scope for v19 at this point.
regards, tom lane
On 8/12/26 01:52, Tom Lane wrote:
Tomas Vondra <tomas.vondra@postgresql.org> writes:
Initial proposal and patch by wenhui qiu, reviews and patch adjustments
by Christoph Berg. A number of other people participated in the
discussion. Benchmarks by me.Backpatch to 19.
[ raised eyebrow... ] I don't object to this change in master,
but it seems pretty out of scope for v19 at this point.
Yeah. The consensus in the discussion thread was it'd be good to do this
in 19, together with the TOAST compression default. I wasn't sure about
that, so I consulted with the RMT and the response was it's OK.
If that's not sufficient, and it's too late for 19, we can revert it.
regards
--
Tomas Vondra
Tomas Vondra <tomas@vondra.me> writes:
On 8/12/26 01:52, Tom Lane wrote:
[ raised eyebrow... ] I don't object to this change in master,
but it seems pretty out of scope for v19 at this point.
Yeah. The consensus in the discussion thread was it'd be good to do this
in 19, together with the TOAST compression default. I wasn't sure about
that, so I consulted with the RMT and the response was it's OK.
Ah. The point about changing this along with the TOAST compression
default does make sense. Objection withdrawn ... but this needs
to get into the v19 release notes beside the other change.
regards, tom lane
On 8/12/26 17:55, Tom Lane wrote:
Tomas Vondra <tomas@vondra.me> writes:
On 8/12/26 01:52, Tom Lane wrote:
[ raised eyebrow... ] I don't object to this change in master,
but it seems pretty out of scope for v19 at this point.Yeah. The consensus in the discussion thread was it'd be good to do this
in 19, together with the TOAST compression default. I wasn't sure about
that, so I consulted with the RMT and the response was it's OK.Ah. The point about changing this along with the TOAST compression
default does make sense. Objection withdrawn ... but this needs
to get into the v19 release notes beside the other change.
Right. Naive question - what's the proper process to make that happen
for changes like this? Ping someone / RMT?
regards
--
Tomas Vondra
Tomas Vondra <tomas@vondra.me> writes:
On 8/12/26 17:55, Tom Lane wrote:
Ah. The point about changing this along with the TOAST compression
default does make sense. Objection withdrawn ... but this needs
to get into the v19 release notes beside the other change.
Right. Naive question - what's the proper process to make that happen
for changes like this? Ping someone / RMT?
You've got a commit bit, go fix doc/src/sgml/release-19.sgml yourself.
Or pester Bruce if you'd rather he did it, but it's simple enough.
regards, tom lane
On 8/12/26 20:32, Tom Lane wrote:
Tomas Vondra <tomas@vondra.me> writes:
On 8/12/26 17:55, Tom Lane wrote:
Ah. The point about changing this along with the TOAST compression
default does make sense. Objection withdrawn ... but this needs
to get into the v19 release notes beside the other change.Right. Naive question - what's the proper process to make that happen
for changes like this? Ping someone / RMT?You've got a commit bit, go fix doc/src/sgml/release-19.sgml yourself.
Or pester Bruce if you'd rather he did it, but it's simple enough.
Ah. For some reason I thought it'd be more complicated. I don't want to
pester Bruce, it seems simple enough (WIP patch attached). I'll take
care of this next week, after I get back home.
regards
--
Tomas Vondra
Attachments:
release-notes.patchtext/x-patch; charset=UTF-8; name=release-notes.patchDownload+16-0
On Fri, Aug 14, 2026 at 12:22:57AM +0200, Tomas Vondra wrote:
On 8/12/26 20:32, Tom Lane wrote:
Tomas Vondra <tomas@vondra.me> writes:
On 8/12/26 17:55, Tom Lane wrote:
Ah. The point about changing this along with the TOAST compression
default does make sense. Objection withdrawn ... but this needs
to get into the v19 release notes beside the other change.Right. Naive question - what's the proper process to make that happen
for changes like this? Ping someone / RMT?You've got a commit bit, go fix doc/src/sgml/release-19.sgml yourself.
Or pester Bruce if you'd rather he did it, but it's simple enough.Ah. For some reason I thought it'd be more complicated. I don't want to
pester Bruce, it seems simple enough (WIP patch attached). I'll take
care of this next week, after I get back home.
I picked up this change along with other changes since mid-July and
applied. I put it next to the TOAST item. I too was surprised by the
backpatch but assumed it was intentional, and later read the thread.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
Do not let urgent matters crowd out time for investment in the future.