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 1wAsam-000Vi5-3C for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 16:50:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wAsal-006hrH-0M for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2026 16:50:56 +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 1wAsak-006hr9-2e for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2026 16:50:55 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wAsaj-00000000DDQ-1vxC for pgsql-hackers@postgresql.org; Thu, 09 Apr 2026 16:50:55 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id EDA761D000A7; Thu, 9 Apr 2026 12:50:49 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 09 Apr 2026 12:50:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1775753449; x=1775839849; bh=YvTGn/lhmY pWZVPvRqQY+S5FRcflfVR/YJW1N2viKY8=; b=TyfWCsrMuReFk/R9jiNNUdP0dz eHHQodz69bQWiv0N6s6sCCa19/h62/HowRXBbRIOVE5TRjZoaUnqTqbXZJCGuNZL kuZV4XhxWEG9f/6C5YRSkoHbofD1U/2rrpHS2DUIH1fYt3CaAdYj3oi+vAC7fBHe pHRMrY8gPHNen3OQszzTtKhWEs00BNd6bnhqMydRYGa4/YKVAazJta2IBvHlBvNg JdRmbg+6qOiLZTg7B4PCXjJnWlD4K0/RKIm+wJPBpU6MARyu/VLHkwvs6Ih0i3mL 1J44YAVI669apLJajGBXZNLIFD98o1Dp3di4Dg5kjwu8/InFjoGZevxYaMRg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1775753449; x=1775839849; bh=YvTGn/lhmYpWZVPvRqQY+S5FRcflfVR/YJW 1N2viKY8=; b=soWjULXslpwIlJB4YOk35ezhTpTF4l5ePZ0Y8bV97/TmySrmLZ4 zSF/IyyCIKfWeTKRDV9wQFGiBjyW5l0x3gyCIABBHeACq70wJSKCqmhmuZJaUKoC f8FOZZJUVBIpHGhP32s/DYQoBL4uJSb+Kq/JvKp8fL/215LSnDzwk53Q8d5U30Bi ImcodFRVgzOqQ0ESOS3pUN2VHIUpBEGyEluVt/HAmpqEi2HWi03OpNUVH/o/IkEC WtIGZmHPrREK+Ecp23M5sDGeVZf4sbEwIAqsEwX4l9O2cAE4wWvkPk7rPDNu1GpF SLfe8/5F5r5bIyIAUHZnpJDeazDlh5KHDhQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddvjedtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecuhfhrohhmpeetnhgurhgvshcu hfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrghtth gvrhhnpeeffffgledvffegtdevlefgtdeggffhvdekgfegteeiveejkeetudelveejhfeu geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnh gurhgvshesrghnrghrrgiivghlrdguvgdpnhgspghrtghpthhtohepgedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvg hsqhhlrdhorhhgpdhrtghpthhtohepvghvghgvnhihrdhvohhrohhprggvvhesthgrnhht ohhrlhgrsghsrdgtohhmpdhrtghpthhtohepthhomhgrshesvhhonhgurhgrrdhmvgdprh gtphhtthhopeiggehmmhhmseihrghnuggvgidqthgvrghmrdhruh X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 9 Apr 2026 12:50:48 -0400 (EDT) Date: Thu, 9 Apr 2026 12:50:48 -0400 From: Andres Freund To: Evgeny Voropaev Cc: Tomas Vondra , PostgreSQL Hackers , Andrey Borodin Subject: Re: Compress prune/freeze records with Delta Frame of Reference algorithm Message-ID: References: <5a2f3df2-a736-4ada-8aa3-aa6e20b2e067@vondra.me> <3fc9f40b-2c4f-49c7-bf1c-570c5b9e6e9e@tantorlabs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3fc9f40b-2c4f-49c7-bf1c-570c5b9e6e9e@tantorlabs.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-04-08 20:34:42 +0800, Evgeny Voropaev wrote: > Tomas, Andreus, Andrey, hello! > > > A ~170kB patch really should present some numbers > > quantifying the expected benefit. It doesn't need to be a real workload > > from production, but something plausible enough. Even some basic > > back-of-the-envelope calculations might be enough to show the promise. > > The patch results in reduction of WAL total size by: > 81% during vacuuming a table having no index, > and by 55% during vacuuming a table having an index. > > The numbers are the next: > > === VACUUM (table with no index) === > -------------------- ----------------- ----------------- ----------- > DFOR off, bytes DFOR on, bytes Reduction > -------------------- ----------------- ----------------- ----------- > WAL total size 6743149 1184446 82% > Prune records size 6710185 1159723 5.8x > -------------------- ----------------- ----------------- ----------- > > === VACUUM (table with index) === > -------------------- ----------------- ----------------- ----------- > DFOR off, bytes DFOR on, bytes Reduction > -------------------- ----------------- ----------------- ----------- > WAL total size 20394208 8907090 56% > Prune records size 6812850 1225944 5.6x > -------------------- ----------------- ----------------- ----------- These numbers make the impact sound bigger than I think it really is: - They neglect that the insert generates ~183MB of WAL, the delete ~161MB without indexes and ~243MB / 161MB with. In contrast to that 6.7Mb isn't particularly significant. - Workloads deleting almost all records in the table but leaving some in to prevent truncation aren't particularly common. - The narrowness of the rows (~30 bytes, with row header) makes the wins much bigger than they'd be in realistic cases - The workload doesn't involve any FPIs. It's much more common to have vacuum's occur later and trigger FPIs. Heh. In this case FPIs actually would *reduce* the overhead of the current code, because the page is so empty after all the deletes that the FPI uses less space than the update . It's 4.1MB when not using indexes and not using wal compression and 1MB with wal compression. Seems we could get a fair bit of benefit by just using a heuristic to switch to an FPI when there are enough changes. I think that'd just be a few lines. Greetings, Andres Freund