Re: WAL compression setting after PostgreSQL LZ4 default change

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, Christoph Berg <myon(at)debian(dot)org>, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, Michael Paquier <michael(at)paquier(dot)xyz>, Japin Li <japinli(at)hotmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, John Naylor <johncnaylorls(at)gmail(dot)com>
Subject: Re: WAL compression setting after PostgreSQL LZ4 default change
Date: 2026-07-16 15:08:09
Message-ID: gf7azery3i6en6pljduxgxb2edikhbrmnvl7tkrt2wryezrrye@b4a3yo37d7pl
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-07-16 17:00:58 +0200, Tomas Vondra wrote:
> On 7/8/26 08:37, wenhui qiu wrote:
> > Hi 
> >
> > > I would like to see "on" to be moved to some better value (likely lz4,
> > > like toast compression), and if some day, there is yet a better
> > > choice, we should move it again.
> > Yes, After PostgreSQL 19, |lz4| became a required dependency unless
> > you compile it yourself with |--without-lz4|. In most
> > environments, |lz4| is already installed, so along this code path
> > the effective choice is essentially fixed to |lz4|.At cluster scale,
> > it would make more sense to expose this parameter in the frontend as
> > a boolean setting, rather than letting users choose from multiple
> > compression options.
> >
> >
> > Thanks 
>
> I've been reminded of this proposal by a message in another thread [1],
> which suggests this proposal (to adjust the wal_compression default) was
> not accepted.
>
> Which seems strange to me, and I suspect it's a misunderstanding. From
> the discussion in this thread it seems to me that:
>
> * the proposal is to change what 'on' means - currently it's always
> pglz, but the proposal would change this to the "best" available
> algorithm (so lz4)
>
> * the wal_compression default would remain "off"
>
> I think this proposal makes sense, and at least Michael and Christoph
> seem to agree with that.

+1 from me too.

I've seen way too many incidents where wal_compression was very useful but due
to the use of pglz slowed down crucial, single threaded, parts of the workload
down so much that it had to be disabled again. We should not make it our
users responsibility to know that the 'on' maps to an almost unusably slow
compression algorithm.

The compatibility concerns are *much* higher for toast compression than for
wal compression, given that toast compression means that you have to build
with the chosen compression pretty much forever, given that the compressed
datum survive pg_upgrade. Whereas wal compression doesn't survive pg_upgrade (
and you probably could even get away with just running with
wal_compression=off for a while and then removing support for the relevant
compression method).

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Andrey Rachitskiy 2026-07-16 15:03:00 Re: pg19b1: TRAP: failed Assert("pgstat_bktype_io_stats_valid(bktype_shstats, MyBackendType)")