pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Change default value of default_toast_compression to "lz4", when
Date: Wed, 04 Mar 2026 04:06:18 +0000
Message-ID: <E1vxdV4-002Hkq-1Y@gemulon.postgresql.org> (raw)

Change default value of default_toast_compression to "lz4", when available

The default value for default_toast_compression was "pglz".  The main
reason for this choice is that this option is always available, pglz
code being embedded in Postgres.  However, it is known that LZ4 is more
efficient than pglz: less CPU required, more compression on average.  As
of this commit, the default value of default_toast_compression becomes
"lz4", if available.  By switching to LZ4 as the default, users should
see natural speedups on TOAST data reads and/or writes.

Support for LZ4 in TOAST compression was added in Postgres v14, or 5
releases ago.  This should be long enough to consider this feature as
stable.

--with-lz4 is removed, replaced by a --without-lz4 to disable LZ4 in the
builds on an option-basis, following a practice similar to readline or
ICU.  References to --with-lz4 are removed from the documentation.

While at it, quotes are removed from default_toast_compression in
postgresql.conf.sample.  Quotes are not required in this case.  The
in-place value replacement done by initdb if the build supports LZ4
would not use them in the postgresql.conf file added to a
freshly-initialized cluster.

For the reference, a similar switch has been done with ICU in
fcb21b3acdcb.  Some of the changes done in this commit are consistent
with that.

Note: this is going to create some disturbance in the buildfarm, in
environments where lz4 is not installed.

Author: Euler Taveira <euler@eulerto.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>
Discussion: https://posgr.es/m/435df33a-129e-4f0c-a803-f3935c5a5ecb@eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7c1849311e49ec57cb86b32a9aa630456588c3f0

Modified Files
--------------
.cirrus.tasks.yml                             |  1 +
configure                                     |  6 ++++--
configure.ac                                  |  2 +-
doc/src/sgml/config.sgml                      | 13 ++++++-------
doc/src/sgml/installation.sgml                | 21 ++++++++++++---------
doc/src/sgml/ref/alter_table.sgml             |  4 +---
doc/src/sgml/ref/create_table.sgml            |  4 +---
doc/src/sgml/ref/pg_receivewal.sgml           |  4 +---
src/backend/access/common/toast_compression.c |  2 +-
src/backend/utils/misc/guc_parameters.dat     |  2 +-
src/backend/utils/misc/postgresql.conf.sample |  2 +-
src/bin/initdb/initdb.c                       |  5 +++++
src/include/access/toast_compression.h        |  9 +++++++++
13 files changed, 44 insertions(+), 31 deletions(-)



view thread (9+ messages)  latest in thread

Message-ID: <E1vxdV4-002Hkq-1Y@gemulon.postgresql.org>
Permalink:  ../E1vxdV4-002Hkq-1Y@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vxdV4-002Hkq-1Y@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Change default value of default_toast_compression to "lz4", when
  In-Reply-To: <E1vxdV4-002Hkq-1Y@gemulon.postgresql.org>

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

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