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 <[email protected]>
Reviewed-by: Peter Eisentraut <[email protected]>
Reviewed-by: Aleksander Alekseev <[email protected]>
Discussion: 
https://posgr.es/m/[email protected]

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

Reply via email to