agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Christoph Berg <myon@debian.org>
To: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: Tomas Vondra <tomas@vondra.me>
Cc: wenhui qiu <qiuwenhuifx@gmail.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Andres Freund <andres@anarazel.de>
Cc: Jelte Fennema-Nio <postgres@jeltef.nl>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Japin Li <japinli@hotmail.com>
Cc: Fujii Masao <masao.fujii@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: John Naylor <johncnaylorls@gmail.com>
Subject: Re: WAL compression setting after PostgreSQL LZ4 default change
Date: Fri, 31 Jul 2026 17:50:41 +0200
Message-ID: <amzEUaGtr8JsMVtR@msg.df7cb.de> (raw)
In-Reply-To: <856ABCB3-1D3A-4E1D-B694-C258E95CA1AC@yandex-team.ru>
References: <ak2Es90xR35P2jPB@msg.df7cb.de>
	<CAGjGUALBMSzJ=ngL0k0CR6MqM+1W=Y+=+MSv+Z4R5jvmr47P5A@mail.gmail.com>
	<50d60598-3fbf-4344-8b07-bf02114f7fd0@vondra.me>
	<gf7azery3i6en6pljduxgxb2edikhbrmnvl7tkrt2wryezrrye@b4a3yo37d7pl>
	<1314f5843859d5f83d5eb0a47b15d9291567cf40.camel@cybertec.at>
	<CAGjGUA+ERbxcGzfiKDT2LpqU095E5=E2BvqCWXMTKgm-jns14Q@mail.gmail.com>
	<amyWkBMR4hKVUZFv@msg.df7cb.de>
	<e160948f-c272-4afb-8109-d82b06e52d11@vondra.me>
	<amyexT2WCaoCBc7G@msg.df7cb.de>
	<856ABCB3-1D3A-4E1D-B694-C258E95CA1AC@yandex-team.ru>

Re: Andrey Borodin
> FWIW on 19beta2, one client: a seqscan setting hint bits on a freshly
> checkpointed 380MB table with wal_log_hints on, so ~47k full-page images
> and little else.  Best of three: off 765ms, pglz 1402ms, lz4 444ms, zstd
> 797ms, writing 382/105/107/67 MB of WAL (fsync off, so the I/O saving is
> understated).  lz4 is the only setting faster than no compression at all,
> while pglz costs nearly double for the size lz4 gives away for free.  zstd
> compresses a third better but pays for it in CPU, partly by allocating a
> ZSTD_CCtx per FPI - see the nearby thread "Compression of bigger WAL
> records".  +1 for "on" meaning lz4 where available.

v4 moves lz4 first.

(I did not include any reason in the commit message about choosing lz4
over zstd yet.)

One minor bit: The patch now has

#if defined(USE_LZ4)
#define DEFAULT_WAL_COMPRESSION·WAL_COMPRESSION_LZ4
#elif defined(USE_ZSTD)
#define DEFAULT_WAL_COMPRESSION·WAL_COMPRESSION_ZSTD

when the old one had
#ifdef USE_ZSTD
#elif defined(USE_LZ4)

I left it at "#if defined(USE_LZ4)" because that looks more
symmetrical.

Christoph

Attachments:

  [text/x-diff] v4-0001-Change-wal_compression-on-to-the-first-of-lz4-zst.patch (0B, ../amzEUaGtr8JsMVtR@msg.df7cb.de/2-v4-0001-Change-wal_compression-on-to-the-first-of-lz4-zst.patch)
  download

view thread (44+ messages)  latest in thread

Message-ID: <amzEUaGtr8JsMVtR@msg.df7cb.de>
Permalink:  ../amzEUaGtr8JsMVtR@msg.df7cb.de/
Also on:    postgresql.org/message-id/amzEUaGtr8JsMVtR@msg.df7cb.de

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: myon@debian.org, x4mmm@yandex-team.ru, tomas@vondra.me, qiuwenhuifx@gmail.com, laurenz.albe@cybertec.at, andres@anarazel.de, postgres@jeltef.nl, michael@paquier.xyz, japinli@hotmail.com, masao.fujii@gmail.com, johncnaylorls@gmail.com
  Subject: Re: WAL compression setting after PostgreSQL LZ4 default change
  In-Reply-To: <amzEUaGtr8JsMVtR@msg.df7cb.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox