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 1vR6hx-006jKr-1a for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Dec 2025 10:37:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vR6hw-002E11-1O for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Dec 2025 10:37:08 +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 1vR6hw-002E0t-0F for pgsql-hackers@lists.postgresql.org; Thu, 04 Dec 2025 10:37:08 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vR6hu-0035SK-1I for pgsql-hackers@lists.postgresql.org; Thu, 04 Dec 2025 10:37:08 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-477a1c28778so10415155e9.3 for ; Thu, 04 Dec 2025 02:37:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764844625; x=1765449425; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=G9kMJvR/tyGvAh/IXQjVLtf+AUtkg1sI//IJ4lw7+Ow=; b=Nxla3xi34VlZ3PeUfe8AWKv+jlLdeZWB85VMp8fot/GsL1OH0wVz84XIxrhZ1TEgev LAvZzFgGHv2wpI8MLFJeANpHQXTXB+GPb3vkF7JRPMrndk64OMlfPdFBSFm9rZu4lKdZ ecFvOPNlbSjzo4/ak4Q4X2LVrPNh5gjBVmuLVwdUHvYGxz7NKXlnYqWDB/Eey9XURpYh 12Wuw9qLZ85/wGa3qRm0u8VS9oVjNUBaOjVcjR651O6AT2tLmTpsO3XjMTNtHlVWKpWN ZxYc9FqYvfa6CUDGjrYjcNR4wu3/bOh0B9sfud3hHjy5etrKl4jfH6EfrJ/xo8XYyo6B 0WLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764844625; x=1765449425; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=G9kMJvR/tyGvAh/IXQjVLtf+AUtkg1sI//IJ4lw7+Ow=; b=Kjd908yrOIHZU5WfRonRD530SLqK86/3pXKtrTLjx/yLPVBw4aUWc3WvbFQGA+kAmV wUl2rZWxlsZ1Wb9jenQmaSGxUee6lzBIXHKpgZUQAIb7woekQBz2pmrhFTSgN6AJLkeG 3zdPP9IBc2DwdkZSW9ILiOs3JAh4G0fbu45+XMkl28EfLyM6eMcT0Ommbz8Nb1dEckcn /ffJRoTIXl0xD6Q+uwTXMhPh5jZtRsQvcISqmR+bCnspl3qsy7nc89lVmLkx/xgdXej9 PD1g0U7of4yq7xgE/bJQyIcQrZdwaQ79YydTF4U07xryU1HfjKpDQscwJP/QxCZa4fO8 4wuQ== X-Forwarded-Encrypted: i=1; AJvYcCV4uhG4LUunUlgrfPNmca30r5bOQamZE/p57UPAKB5V/AbF77WS6rcIKViNTIA0hv9/UsG1LPpY3I2TgNY3@lists.postgresql.org X-Gm-Message-State: AOJu0Yxv+pSfGDnCrhUvmdxakmbJFq4zMazTgoMIUX/TDJahOFyKF9OW S8BhDsi8Z8WpHPplnio4/nhsf5rLWS5N2TP2n4iWUqCGKQl21TShXt9OGO12lnQbzQ6H2gZQGPu OASqZ3dFBYSFBrHwV797rIQp5BIbBQl8= X-Gm-Gg: ASbGncu0tMgAwQ/FF+hYuzRnkSzBtA8kdTgS5fY9jx5k49siinS9AO3aPfuFFQ/Ln7U +waiSdp1DedfNTonFEvl85FrZVADwIOOtCnIrZ3Dsbi4dRJUHOVZq67XzWkOJQxoVyW2W4uYCrm 5tMkC9Bwao/KVZ6ENuba7O/DieSWYH/joT+r01iYptclvW+ou/fBmY6mAdadSQbxJzB3Flpa8E+ ZOa+dxriAY1m5oCddi5+CvHm5Bik/xkqMpZVdd8QvFo8srZP5GEinXy7vhWVbuP8GdQd847VTpK cHJUDcwU X-Google-Smtp-Source: AGHT+IHNS0iXXqdYNyY3uYUKo17R1iCHOjxeSNDAC3a55umhxWZOyxfM//ytJ4SIpotV6DnO8UUl2/OOQq9OiGj/9NI= X-Received: by 2002:a05:6000:288f:b0:42b:3220:93e8 with SMTP id ffacd0b85a97d-42f7986f12amr2572804f8f.57.1764844624517; Thu, 04 Dec 2025 02:37:04 -0800 (PST) MIME-Version: 1.0 References: <36531c0e-292c-409d-bbc7-a252cf6e910a@iki.fi> <54aa8f65-f0e4-4464-b543-e0399c1cab1e@iki.fi> <4a9dda70-0af7-41a4-9636-b168f2fc48ef@iki.fi> <46cc45e9-fddd-44bc-bcb3-96889aafd921@iki.fi> <6c298bc4-7029-4c1d-bf16-3e094842ce32@iki.fi> <9ee6324a-44fc-42fb-bf8e-7c3b53395588@iki.fi> <52227f05-51aa-40c4-8f83-9c79fff16175@iki.fi> <5c4b2864-3baf-4ebc-8405-280fc1a1c8a9@iki.fi> In-Reply-To: <5c4b2864-3baf-4ebc-8405-280fc1a1c8a9@iki.fi> From: Ashutosh Bapat Date: Thu, 4 Dec 2025 16:06:51 +0530 X-Gm-Features: AWmQ_bkqTJO-yqJ3wMmctyYeC77H2Oqch4QWX5L2Hww_A_qanuq-qtTJgz3nSUc Message-ID: Subject: Re: POC: make mxidoff 64 bits To: Heikki Linnakangas Cc: Maxim Orlov , Alexander Korotkov , Alvaro Herrera , wenhui qiu , Postgres hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Dec 3, 2025 at 5:34=E2=80=AFPM Heikki Linnakangas = wrote: > > On 03/12/2025 11:54, Maxim Orlov wrote: > > The biggest problem with compression, in my opinion, is that losing > > even one byte causes the loss of the entire compressed block in the > > worst case scenario. After all, we still don't have checksums for the > > SLRU's, which is a shame by itself. > > > > Again, I'm not against the idea of compression, but the risks need to > > be considered. > > There are plenty of such critical bytes in the system where a single bit > flip renders the whole block unreadable. Actually, if we had checksums > on SLRU pages, a single bit flip anywhere in the page would make the > checksum fail and render the block unreadable. > > If things go really bad and you need to open a hex editor and try to fix > the data manually, it shouldn't be too hard to deduce the correct base > offset from surrounding data. > > > As a software developer, I definitely want to implement compression and > > save a few gigabytes. However, given my previous experience using > > Postgres in real-world applications, reliability at the cost of several > > gigabytes would not have caused me any trouble. Just saying. > > +1. If we decide to do some kind of compression here, I want it to be > very simple. Otherwise it's just not worth the code complexity and risk. > > Let's do the math of how much disk space we'd save. Let's assume the > worst case that every multixid consists of only one transaction ID. > Currently, every such multixid takes up 4 bytes in the offsets SLRU, and > 5 bytes in the members SLRU (one flag byte and 4 bytes for the XID). So > that's 9 bytes. With 64-bit offsets, it becomes 13 bytes. With the > compression, we're back to 9 bytes again (ignoring the one base offset > per page). So in an extreme case that you have 1 billion multixids, with > only one XID per multixid, the difference is between 9 GB and 13 GB. > That seems acceptable. > > And having just one XID per multixid is a rare corner case. Much more > commonly, you have at at least two XIDs. With two XIDs per multixid, the > difference is between 14 bytes and 18 bytes. > > And having a billion multixids is pretty extreme. Your database is > likely very large too if you reach that point, and a few gigabytes won't > matter. I am in favour of keeping things simpler than using a complex compression. > > One could argue that the memory needed for the SLRU cache matters more > than the disk space. That's perhaps true, but I think this is totally > acceptable from that point of view, too. This brings an interesting point. Since the offsets are twice large, SLRU will contain half the entries than earlier. Have we measured performance impact of this? Do we need to provide some guidance about increasing the SLRU size or increase the default SLRU size? --=20 Best Wishes, Ashutosh Bapat