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 1vrvH8-00D6B0-2N for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 09:52:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vrvH5-000chq-2k for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Feb 2026 09:52:15 +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 1vrvDD-0006UY-1L for pgsql-hackers@lists.postgresql.org; Mon, 16 Feb 2026 09:48:15 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vrtbA-00000000ysU-2C6m for pgsql-hackers@postgresql.org; Mon, 16 Feb 2026 08:04:54 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-48069a48629so27173955e9.0 for ; Mon, 16 Feb 2026 00:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=percona.com; s=google; t=1771229090; x=1771833890; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=q1ggfwuvnMZvaHfPuSLXUQ5TThTOtl+Dxwtk/VgEVqA=; b=BpyBlDNSsC2jOLCw2ir7Dqba6n5O4gkOKovQBNIycL3PMLo7uHTHfewFx71EE/O7Hk ypx55jKCe1E/WmpfIFtlFK4McjAaxQfLJoYNCQfVwr6r7Nk9/AZxnl1j2PQAb/CY5z/G RYhkraRlzFa6zBHZaPNRRucUDvzrA/7IgDZN8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771229090; x=1771833890; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=q1ggfwuvnMZvaHfPuSLXUQ5TThTOtl+Dxwtk/VgEVqA=; b=AIZQWoK0T0XPMY5JqCBYaEqSg1YokM6JTpXUWlr87uTsn/KzF/8QKz+pVuX9QKxUCc QyxSerkyA9j8sERsMXg63Wy/Q2rPflrWOoubQ4g5d0kKcuxCohotlniHLdBi4riU50Dc krbKrgbxQLGDri57kHyZXkBP0Ks+k8x0UAyzr5SNC/WZMi+IQzVf+zh2Xpx+a0N1e6DD gXyccG4K+LO5kH2B0zE3OupI0D5PmjKae3vHiMZgeS8xMTzmfCsuF2aVAug7b/uwqZcZ nYeRg4DeBWv/7cdR7hr7mydJiRvuQLLZ+TlluGm0iJHhhokNRbkUgPiQ1N/ZvEl3nwFf OUiw== X-Gm-Message-State: AOJu0Yx7XwKghX8Mvhytvu4wPCvRf1Iw327RO6E7+Gk1FptRzgt/CdyN Vxz6mkG0vYtgSwvyJXnhd9hFGbHlnBs6zwU828SesYYZlYkevriIGdop9kLeBQY/63Y3tx+zU+q 1peC//mPcc/tVak85Zs/VkikqYWNCYj8IZReKVvKTYm6mFOAhbw2Zo4FIUvFI3Y/RdDL8KnGifW 64AC7X9TU7N70VDmmdD2F3Q08YaPlQQwaZigTNfKck89xhoAdEeTLFBUhX+ABsXEMgbnW0NxMf X-Gm-Gg: AZuq6aJA1C9B0s3p3yLy4gyFIkidomOP9A7rG9oENNeDg1yOTmHvhO9xWEEgLMrVMDo jYbPlbSUluMu0mxQEZPnxQRhpF9mjwiINeNoZdfqlOiy0eCkM+u2FLuTtwsghw9M6bAWGUUKUQr iesRvD/v2xVIcrdT8X2s21XrRRrq3dUaQDYQGAGEXbGz8gTPSzxytCgejFv9EfhGV/baqKzb2VY yXw6n0xMPTv8SkievswnqRa40G8aHf73oxi5/D2NGQcd3PinK8tTjh78Dlw2X+lDdL/l213WCJs 1ABt24I+fyyNmCIIV0RvwqQEc3d/fR+h4XVTgF+ZEMIMIazvI5A9asuC7kscQ/ENNh2ooAtKCn4 osm8MSBSrIWMgL1TUqdCeNhvmzXIG5BkWHU2mx9RMhM6r/r1gaFZ+Jo6MSpO5HFLGy2aTLmMMnZ NmQxndPwDLsIbzKArRTu+4f82UrPxTE26igvsW4yn4OCWfqMICsuD0xeDd/A== X-Received: by 2002:a05:600c:148f:b0:483:7f7c:ad89 with SMTP id 5b1f17b1804b1-4837f7cb108mr67401595e9.37.1771229089914; Mon, 16 Feb 2026 00:04:49 -0800 (PST) Received: from smtpclient.apple ([139.138.202.245]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4834d82a4afsm775766915e9.11.2026.02.16.00.04.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Feb 2026 00:04:49 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: Lowering the default wal_blocksize to 4K From: Andy Pogrebnoi In-Reply-To: <20231009230805.funj5ipoggjyzjz6@awork3.anarazel.de> Date: Mon, 16 Feb 2026 10:04:37 +0200 Cc: pgsql-hackers@postgresql.org, Heikki Linnakangas , Robert Haas , Thomas Munro , Matthias van de Meent Content-Transfer-Encoding: quoted-printable Message-Id: References: <20231009230805.funj5ipoggjyzjz6@awork3.anarazel.de> To: Andres Freund X-Mailer: Apple Mail (2.3864.300.41.1.7) X-CLOUD-SEC-AV-Sent: true X-CLOUD-SEC-AV-Info: percona,google_mail,monitor X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, > On Oct 10, 2023, at 02:08, Andres Freund wrote: >=20 > Hi, >=20 > I've mentioned this to a few people before, but forgot to start an = actual > thread. So here we go: >=20 > I think we should lower the default wal_blocksize / XLOG_BLCKSZ to = 4096, from > the current 8192. I prepared a patch in case we want to move with the default 4kb = XLOG_BLCKSZ. Regarding reducing the page headers' size, the benefits of 4Kb = wal_blocks outweight disadvantages of the proportionally bigger header in my = opinion. Since we recycle WAL segments, the added size won't go to the disk usage = but rather cause a bit more freqent segment. And maybe this is what is also = worth looking at regarding XLOG_BLCKSZ. I wanted to look into WAL segments preallocation after an off-the-list conversation with Andres anyway. But = the added overhead is not that significant.=20 > One thing I noticed is that our auto-configuration of wal_buffers = leads to > different wal_buffers settings for different XLOG_BLCKSZ, which = doesn't seem > great. I don't think it's an issue as wal_buffers are in block units, not = bytes. Even though the auto-tuned number may change, the total amount of bytes still = remains the same with different XLOG_BLCKSZ. > For some example numbers, I ran a very simple insert workload with a = varying > number of clients with both a wal_blocksize=3D4096 and = wal_blocksize=3D8192 > cluster, and measured the amount of bytes written before/after. I've also run some simple tests on my local machine (Ubuntu in Vagrant = on M1 Mac). I run a sysbench write-only load for 20s with different amounts of = threads (and tables equal to the number of threads num) and measured disk writes = with iostat. I recreated tables and did a checkpoint before each run. These = are my results: 8Kb XLOG_BLCKSZ =3D=3D=3D=3D Threads tps kB_wrtn 1 535.34 207288 5 1457.24 591708 10 1441.85 574700 15 823.98 388732 4Kb XLOG_BLCKSZ =3D=3D=3D=3D Threads tps kB_wrtn 1 542.02 153544 5 1556.83 393444 10 1288.00 339648 15 975.32 255708 I will run more benchmarks on proper hardware. For example, interesting = what=20 happens to performance with >4K writes. But what else do you think has = to be done to move this patch forward? --- Cheers, Andy