| From: | Japin Li <japinli(at)hotmail(dot)com> |
|---|---|
| To: | wenhui qiu <qiuwenhuifx(at)gmail(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, John Naylor <johncnaylorls(at)gmail(dot)com>, Christoph Berg <myon(at)debian(dot)org> |
| Subject: | Re: WAL compression setting after PostgreSQL LZ4 default change |
| Date: | 2026-07-03 02:18:08 |
| Message-ID: | SY7PR01MB10921C1429F001C87B6ECDB6BB6F42@SY7PR01MB10921.ausprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 01 Jul 2026 at 09:53, wenhui qiu <qiuwenhuifx(at)gmail(dot)com> wrote:
> Hi Michael
>
> > If I were switch the default, for me zstd goes first, lz4 is a close
> > second, and pglz is the last of its class. The only reason why we
> > have not chosen zstd for TOAST is the fact that we don't support it
> > (trickier to add support for it as we have to preserve on-disk
> > compatibility for inline compressed TOAST entries).
>
> > In short, lz4 is available in many environments, but I'm also ready to
> > bet that zstd is equally available in these environments.
> Thanks for the feedback.
>
> Yes, I did consider zstd as well. I agree that zstd can provide a better
> compression ratio than lz4, and if we only look at compression ratio, zstd is
> a very attractive choice.
>
> The reason I started with lz4 was mainly to keep this change aligned with the
> recent TOAST compression change. Since lz4 has already been accepted there as
> the preferred default when available, I thought using the same choice for
> wal_compression=on would make the proposal smaller, more consistent, and easier
> to evaluate. so
>
> Second, WAL compression happens on the WAL insertion path for full-page images,
> so compression speed and CPU overhead matter a lot. lz4 is generally a good fit
> for that trade-off: it still reduces WAL volume, while keeping compression
> latency and CPU cost lower than zstd in many workloads.
>
> That said, I understand the argument for preferring zstd when it is available.
> I have prepared an alternative version where wal_compression=on selects zstd
> first, then lz4 if zstd is not available, and finally pglz as the fallback
>
> Thanks
Thanks for updating the patch. I've registered it in the CommitFest [1].
[1] https://commitfest.postgresql.org/patch/6979/
--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Guo | 2026-07-03 02:27:22 | Re: pg_plan_advice: FOREIGN_JOIN advice generated for a single-relation foreign scan is not round-trip safe |
| Previous Message | Ewan Young | 2026-07-03 02:14:12 | Re: JSON_VALUE/JSON_TABLE DEFAULT expression ignores RETURNING typmod |