pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Change default value of default_toast_compression to "lz4", when
9+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2026-03-04 4f0b3afab4  Revert "Change default value of default_toast_compression to "lz4""
* pgsql: Change default value of default_toast_compression to "lz4", when
@ 2026-03-04 04:06  Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 9+ messages in thread

From: Michael Paquier @ 2026-03-04 04:06 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Change default value of default_toast_compression to "lz4", when
@ 2026-03-04 17:01  Jacob Champion <jacob.champion@enterprisedb.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 2 replies; 9+ messages in thread

From: Jacob Champion @ 2026-03-04 17:01 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>; Mark Wong <markwkm@gmail.com>

On Tue, Mar 3, 2026 at 8:06 PM Michael Paquier <michael@paquier.xyz> wrote:
>
> Change default value of default_toast_compression to "lz4", when available
>
> ...
>
> Note: this is going to create some disturbance in the buildfarm, in
> environments where lz4 is not installed.

I know there's no "good time" to change a configuration default, but
the timing now is especially unfortunate, because Mark maintains many
of those failing animals and he is traveling this week. Any chance we
can delay this patch a bit to coordinate, and keep the buildfarm
green?

--Jacob





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Change default value of default_toast_compression to "lz4", when
@ 2026-03-04 22:34  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jacob Champion <jacob.champion@enterprisedb.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Tom Lane @ 2026-03-04 22:34 UTC (permalink / raw)
  To: Jacob Champion <jacob.champion@enterprisedb.com>; +Cc: Michael Paquier <michael@paquier.xyz>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>; Mark Wong <markwkm@gmail.com>

Jacob Champion <jacob.champion@enterprisedb.com> writes:
> I know there's no "good time" to change a configuration default, but
> the timing now is especially unfortunate, because Mark maintains many
> of those failing animals and he is traveling this week. Any chance we
> can delay this patch a bit to coordinate, and keep the buildfarm
> green?

By my count, two-thirds of the buildfarm is broken.  (100 failing
animals, 56 working ones have reported since this commit.)

We would not normally tolerate leaving things that way for any
great length of time, and I don't think this commit should get
a pass.  I think it needs to be reverted until a very much
larger fraction of buildfarm owners have prepared for it.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Change default value of default_toast_compression to "lz4", when
@ 2026-03-04 22:41  Michael Paquier <michael@paquier.xyz>
  parent: Jacob Champion <jacob.champion@enterprisedb.com>
  1 sibling, 0 replies; 9+ messages in thread

From: Michael Paquier @ 2026-03-04 22:41 UTC (permalink / raw)
  To: Jacob Champion <jacob.champion@enterprisedb.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>; Mark Wong <markwkm@gmail.com>

On Wed, Mar 04, 2026 at 09:01:06AM -0800, Jacob Champion wrote:
> I know there's no "good time" to change a configuration default, but
> the timing now is especially unfortunate, because Mark maintains many
> of those failing animals and he is traveling this week. Any chance we
> can delay this patch a bit to coordinate, and keep the buildfarm
> green?

There will never be a perfect time for such a change.  And after that
comes the fact I am out for most of the end of the dev cycle (spring
vacations and the end of the fiscal year here), so if we were to do
again the same thing in two weeks, I would not be able to follow up.

For now, I am collecting data about all the buildfarm members showing
in red, and I'll send direct notices to each owner through the day to
reduce the blast, in the shape of one email for each owner and for all
his/her hosts failing.  I am wondering if this is going to display
bugs with LZ4, actually, the extend of the red-ness of the buildfarm
shows that we did not test it much on some niche places.  I have
enabled it on my machines for a few years now, but it's clearly not a
popular choice.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Change default value of default_toast_compression to "lz4", when
@ 2026-03-04 22:47  Michael Paquier <michael@paquier.xyz>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Michael Paquier @ 2026-03-04 22:47 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jacob Champion <jacob.champion@enterprisedb.com>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>; Mark Wong <markwkm@gmail.com>

On Wed, Mar 04, 2026 at 05:34:49PM -0500, Tom Lane wrote:
> By my count, two-thirds of the buildfarm is broken.  (100 failing
> animals, 56 working ones have reported since this commit.)
> 
> We would not normally tolerate leaving things that way for any
> great length of time, and I don't think this commit should get
> a pass.  I think it needs to be reverted until a very much
> larger fraction of buildfarm owners have prepared for it.

Hmm.  If you guys feel strongly about it, I'd be OK to revert.  Now
there is a way to split the pie into two halves: we can still
introduce DEFAULT_TOAST_COMPRESSION and use lz4 as default for the GUC
if lz4 is included in the build but, leave the switch of --with-lz4 to
--without-lz4 out of the equation.  This choice would leave the
buildfarm in piece, and it still achieves the goal of enabling LZ4 in
TOAST by default, as long as --without-lz4 is used.  As long as the
latter is achieved, the point of the change would be made.

Opinions?
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Change default value of default_toast_compression to "lz4", when
@ 2026-03-04 22:51  Michael Paquier <michael@paquier.xyz>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 9+ messages in thread

From: Michael Paquier @ 2026-03-04 22:51 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jacob Champion <jacob.champion@enterprisedb.com>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>; Mark Wong <markwkm@gmail.com>

On Thu, Mar 05, 2026 at 07:47:03AM +0900, Michael Paquier wrote:
> Hmm.  If you guys feel strongly about it, I'd be OK to revert.  Now
> there is a way to split the pie into two halves: we can still
> introduce DEFAULT_TOAST_COMPRESSION and use lz4 as default for the GUC
> if lz4 is included in the build but, leave the switch of --with-lz4 to
> --without-lz4 out of the equation.  This choice would leave the
> buildfarm in piece, and it still achieves the goal of enabling LZ4 in
> TOAST by default, as long as --without-lz4 is used.  As long as the
> latter is achieved, the point of the change would be made.


As I had the idea to press send too quickly, here's a reformulated
version.  ;)

We can still introduce DEFAULT_TOAST_COMPRESSION and use lz4 as
default for the GUC if lz4 is included in the build but leave the
switch of --with-lz4 to --without-lz4 out of the equation.  This
choice would leave the buildfarm in peace, and it still achieves the
goal of enabling LZ4 in TOAST by default, as long as --with-lz4 is
used.  As long as the latter goal is achieved, the point of the change
would be made, at least partially.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Change default value of default_toast_compression to "lz4", when
@ 2026-03-04 23:22  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2026-03-04 23:22 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Jacob Champion <jacob.champion@enterprisedb.com>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>; Mark Wong <markwkm@gmail.com>

Michael Paquier <michael@paquier.xyz> writes:
> We can still introduce DEFAULT_TOAST_COMPRESSION and use lz4 as
> default for the GUC if lz4 is included in the build but leave the
> switch of --with-lz4 to --without-lz4 out of the equation.  This
> choice would leave the buildfarm in peace, and it still achieves the
> goal of enabling LZ4 in TOAST by default, as long as --with-lz4 is
> used.  As long as the latter goal is achieved, the point of the change
> would be made, at least partially.

That works for me as a temporary solution.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* pgsql: Change default value of default_toast_compression to "lz4", take
@ 2026-03-05 00:26  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 9+ messages in thread

From: Michael Paquier @ 2026-03-05 00:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Change default value of default_toast_compression to "lz4", take two

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.

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.

Note that this is a version lighter than 7c1849311e49, that included a
replacement of --with-lz4 by --without-lz4 in configure builds, forcing
a requirement for LZ4 in all environments.  The buildfarm did not like
it, at all.  This commit switches default_toast_compression to lz4 as
default only when --with-lz4 is defined, which should keep the buildfarm
at bay while still allowing users to benefit from LZ4 compression in
TOAST as long as the code is compiled with it.

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/34dfca293432e206b8f80431f81535aff69782ca

Modified Files
--------------
doc/src/sgml/config.sgml                      | 3 ++-
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 +++++++++
6 files changed, 19 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgsql: Change default value of default_toast_compression to "lz4", when
@ 2026-03-05 17:34  Jacob Champion <jacob.champion@enterprisedb.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 9+ messages in thread

From: Jacob Champion @ 2026-03-05 17:34 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Michael Paquier <michael@paquier.xyz>; PostgreSQL Hackers <pgsql-hackers@postgresql.org>; Mark Wong <markwkm@gmail.com>

On Wed, Mar 4, 2026 at 3:22 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Michael Paquier <michael@paquier.xyz> writes:
> > We can still introduce DEFAULT_TOAST_COMPRESSION and use lz4 as
> > default for the GUC if lz4 is included in the build but leave the
> > switch of --with-lz4 to --without-lz4 out of the equation.

Thanks for the patches Michael; the farm looks much more verdant now.

--Jacob





^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2026-03-05 17:34 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-04 04:06 pgsql: Change default value of default_toast_compression to "lz4", when Michael Paquier <michael@paquier.xyz>
2026-03-04 17:01 ` Jacob Champion <jacob.champion@enterprisedb.com>
2026-03-04 22:34   ` Tom Lane <tgl@sss.pgh.pa.us>
2026-03-04 22:47     ` Michael Paquier <michael@paquier.xyz>
2026-03-04 22:51       ` Michael Paquier <michael@paquier.xyz>
2026-03-04 23:22         ` Tom Lane <tgl@sss.pgh.pa.us>
2026-03-05 17:34           ` Jacob Champion <jacob.champion@enterprisedb.com>
2026-03-04 22:41   ` Michael Paquier <michael@paquier.xyz>
2026-03-05 00:26 pgsql: Change default value of default_toast_compression to "lz4", take Michael Paquier <michael@paquier.xyz>

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