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 1w3UlZ-001HHn-2J for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 07:59:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3UlY-004xUI-0L for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 07:59:32 +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 1w3UlX-004xUA-1M for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 07:59:32 +0000 Received: from fhigh-a7-smtp.messagingengine.com ([103.168.172.158]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w3UlU-000000008yv-0OxX for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 07:59:31 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 52CB914000F7; Fri, 20 Mar 2026 03:59:26 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Fri, 20 Mar 2026 03:59:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1773993566; x=1774079966; bh=t gN07MQsfj1ruc/WfMuze5l6Xw3fGrIuMRmVQokfo9w=; b=Ziq2UPw7s1DrZNdkD qtjFGEf6qsoh/S026mluz5jKMbd8AU0YsuQRpw2ZPAukZhiYmQ0+e2W35MO76rIY Ajx+rlBU4Rz2+glDjnVb556tcKO59CSbX7VUs2OJuJGczNsF2esfzucsJzZLHT36 O+bFoPbS1BMmZ0+UpelRRN5aJGDgKxGHkN1TpyT3bKcgQefpudS2G4pfSz01C1P6 fDvtYaiJv/i1BrWXjhxkx0Bwtukl9FlDYqcWxEi58h9j5Lt9vHx30dIC8SdYZm5o xQIftEWcn8X93ve8n8zAcvsj97Qy7TTYrg/YhokAagH7WLjtDyoWOO1YwAYqq1Cp lBDcA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeftdelfeehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepgfdtgeelgefgffdtieduudffhfevkefgudefteehgfethfek vdegjeelhfethedvnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhdpph hoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnh gspghrtghpthhtohepiedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprghhsegt higsvghrthgvtgdrrghtpdhrtghpthhtohepsghovghkvgifuhhrmhdophhoshhtghhrvg hssehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhhihhgrihhlnhhikhgrlhgrhigvuhes ghhmrghilhdrtghomhdprhgtphhtthhopehsrhhinhgrthhhvddufeefsehgmhgrihhlrd gtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshht ghhrvghsqhhlrdhorhhgpdhrtghpthhtoheprhhosgesgiiiihhllhgrrdhnvght X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 20 Mar 2026 03:59:25 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1773993563; bh=wMtLmugYPD3Sb5Q9o+TyRreO0BVI16nfpGD3wHnrIuM=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=G5E5sJhb4pTU+W/lZvIVHyXad5ocrUiJwh25LUqLp2XZwEHKIpJei6VA/Wpm1nsjP iAfYkbBpKXvR7PDPS2F7jZo9yJn4dRituuQ8Z1X9tAZ7kQlp5o5unbK7zc6pcTXWLa rHoGPnD1Di6ebhYAsldmXaw968ebLHHf5M7BdVK3p5JsJw7LJlrrwdDonqsZlIxEXY N9foUXOLc3BKnjAxqCTrSCFCuoNLahMyU8DNK0s/LeXTvNvWB3lUnJY9vQaYIvfbAJ YTva75F+hdA3wnFBSIySZDjREX1zHIBFO6JIr0qRurFhUn/8CscLdHkqs/4xCwggB5 DW3P1BjtXTEaQ== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 654495F; Fri, 20 Mar 2026 08:59:23 +0100 (CET) Date: Fri, 20 Mar 2026 08:59:23 +0100 From: Alvaro Herrera To: Antonin Houska Cc: Srinath Reddy Sadipiralla , Matthias van de Meent , Mihail Nikalayeu , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] Message-ID: <202603200752.zigubezzfcql@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <34692.1773952655@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Mar-19, Antonin Houska wrote: > Alvaro Herrera wrote: > > > So here's v43. Here, I've changed the CONCURRENTLY implementation to go > > through table AM. This necessitated changing it to use tuples in slots > > instead of HeapTuple. This is good because we can avoid repeated tuple > > form/deform, which could get pretty expensive. Antonin's 0004 patch > > here looks suspicious here though, because it deforms the tuple and > > forms it again, which sounds unnecessary now. > > I suppose you mean > v42-0004-Serialize-decoded-tuples-without-flattening.patch. This deforms the > tuple to get the external attributes and to write them to file. The tuple the > logical worker received from reorderbuffer.c cannot be passed to the backend > executing REPACK because it may contain "external indirect" attributes, > i.e. pointers to the worker's memory. No, that patch has been absorbed in what is now v43-0003. I meant v43-0004 "Use BulkInsertState when copying data to the new heap.", that's why I said "patch 0004 here". In this patch, we have reform_tuple which deforms the tuple, sets to NULL any attribute that's marked dropped, and then forms a new one. This is wasteful and should probably be done elsewhere, while the tuple is still in slot representation. In fact, I suspect it may not be necessary at all anymore. I haven't verified whether all the code is covered by existing tests; what I did was just run them. But to ensure that it is all trustworthy, I'll spend some time with the coverage report to ensure there aren't any nasty surprises anywhere. The slot/tupdesc interface is notoriously bad at differentiating 0-based indexes of the attribute array, and 1-based proper attribute numbers, so it's very easy to do the wrong thing. (It's worse when you do an even number of wrong things and they cancel each other out.) -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "This is what I like so much about PostgreSQL. Most of the surprises are of the "oh wow! That's cool" Not the "oh shit!" kind. :)" Scott Marlowe, http://archives.postgresql.org/pgsql-admin/2008-10/msg00152.php