Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wppVe-001s03-1I for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jul 2026 15:50:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wppVd-00Gjy3-0h for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Jul 2026 15:50:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wppVc-00Gjxv-2h for pgsql-hackers@lists.postgresql.org; Fri, 31 Jul 2026 15:50:52 +0000 Received: from stravinsky.debian.org ([2001:41b8:202:deb::311:108]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wppVa-00000001JLd-16zc for pgsql-hackers@postgresql.org; Fri, 31 Jul 2026 15:50:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description; bh=XqMbBH+C6x4cQ+0TfHqegi1I78sm30ZjHr55O82n6lA=; b=UvCGsppFlw23sC9A4evbm2+ZNj zkWkEmad5FXeqQ2FSEw9N0l1C3exYTQr4u8oAyWf00MgGdD5JjgoBkqyNPLUvn9NU24h4omw6Syrw C5cCStGQ8mGhtRZPCfbM3GBlodJseTLmUuqzXAZxYgYpbvY/BHbVSRmnoMvIww/GBc9JFDTrls56t p6F7Y9CifLDchzMiB64TPxqY72Lo6yR5Yg9QY0rPO2emC2sI93dZG8DkEVKQOJTeqVA9ep+1vlYkL YzKE+WT8ZK+jWbRPIL+WHXMQF55QWxFcAamE7hGQ6RzAp3eaxIkXW/Bb0UJ8fwm7g3ddzZngiKS+h NYxnpwMA==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wppVS-00A8IE-00; Fri, 31 Jul 2026 15:50:42 +0000 Date: Fri, 31 Jul 2026 17:50:41 +0200 From: Christoph Berg To: Andrey Borodin Cc: Tomas Vondra , wenhui qiu , Laurenz Albe , Andres Freund , Jelte Fennema-Nio , Michael Paquier , Japin Li , Fujii Masao , pgsql-hackers , John Naylor Subject: Re: WAL compression setting after PostgreSQL LZ4 default change Message-ID: Mail-Followup-To: Christoph Berg , Andrey Borodin , Tomas Vondra , wenhui qiu , Laurenz Albe , Andres Freund , Jelte Fennema-Nio , Michael Paquier , Japin Li , Fujii Masao , pgsql-hackers , John Naylor References: <50d60598-3fbf-4344-8b07-bf02114f7fd0@vondra.me> <1314f5843859d5f83d5eb0a47b15d9291567cf40.camel@cybertec.at> <856ABCB3-1D3A-4E1D-B694-C258E95CA1AC@yandex-team.ru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="vDkUrtfZPOyy795V" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <856ABCB3-1D3A-4E1D-B694-C258E95CA1AC@yandex-team.ru> X-Debian-User: myon List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --vDkUrtfZPOyy795V Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 --vDkUrtfZPOyy795V Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename=v4-0001-Change-wal_compression-on-to-the-first-of-lz4-zst.patch