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 1vvFLF-00AH4f-0F for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Feb 2026 13:54:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vvFLE-006Mvc-02 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Feb 2026 13:54:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vvFLD-006MvU-2B for pgsql-hackers@lists.postgresql.org; Wed, 25 Feb 2026 13:54:15 +0000 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vvFLA-000000017uX-2p3q for pgsql-hackers@lists.postgresql.org; Wed, 25 Feb 2026 13:54:14 +0000 Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id 11AA1EC05AB; Wed, 25 Feb 2026 08:54:13 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 25 Feb 2026 08:54:13 -0500 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=fm3; t=1772027653; x=1772114053; bh=d V0gC3T+QNE1YAkXn/BHBIJQbeLV/bUaxbs6ts1/GQU=; b=nktEPD6dEIX9axla/ UVppxigN3Sy73Q0DkY9UJ12ZO9maRZfKpKWQaQuV1xGIlZRVtXiPU2zAxyW82Gib 2C7VeyStXGhM2yxh/TMnQ486NbNoO/9JNG2bL5aFrqb55oMbCaWexy2cohaeOwo5 pU7mitNg6CMfZPlot+OtIQTA3NmbcYyz6+q0GaLcgXrulDqkzT4f7SXR+mNP4BNl 8f6+8BytL9FufdqEWVJHpj2E7VvPk6Mj1dRPV3HTyhzS7JI3mppNCi6YSM/CN3Bs 4xp+UeLh4e2RdBvABJ+F++rObOTfELuHsEJ446gC2euG/+FrrKSIX0l8X4d2+Gim A8hKQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgeefvdejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeekfffg udffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsggprhgtphhtthhopeegpdhmohguvg epshhmthhpohhuthdprhgtphhtthhopegrhhestgihsggvrhhtvggtrdgrthdprhgtphht thhopehmihhhrghilhhnihhkrghlrgihvghusehgmhgrihhlrdgtohhmpdhrtghpthhtoh epphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg pdhrtghpthhtoheprhhosgesgiiiihhllhgrrdhnvght X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 25 Feb 2026 08:54:12 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1772027649; bh=Dug7e1N/tMA/fMxsGXRUPBJpVISkaLnvGX31Ousb5DQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=eULjS4c+IuNHwMLrGJG1T25/ZLjjxOBOjLtGHXRFssKO6YS+rRRGk1THtGqRkhXtf jp6JrYg9ejdurz7TznCVGqvsGygkpWfMhL1TF6PL6/CSjaid3T3M5SFmBzgmTPPfjc 5I1p26SBfM9dZvIb+NJgeGFZrSfB4OoznFd4bNev4V0dXRSJi8xdX8sdQivER8sd13 nguhlIZCur6EnzgBort6EPowtXDuUAA/IfDHrvWrzgOGJCJ+ZAH1rQoO7me6D4X7fK jneiGWolzUdzJQ4taNdWkp31I6VE6Bt7ZbkQONgPvaLV4zwaEDj2sEha0mR4f0VCeO gism9f/k6ACbA== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 75F287A; Wed, 25 Feb 2026 14:54:09 +0100 (CET) Date: Wed, 25 Feb 2026 14:54:09 +0100 From: Alvaro Herrera To: Antonin Houska Cc: Mihail Nikalayeu , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] Message-ID: <202602251344.gtuwb7nbk7m3@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9116.1772009759@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Feb-25, Antonin Houska wrote: > In 0005 ("Use background worker to do logical decoding"), the function is a > bit simpler because here the decoding worker uses temporary file to send the > data to the REPACKing backend, rather than tuplestore. Ah, that patch changes the implementation rather substantially then; I didn't realize that because I haven't been looking at it yet, as I wanted to have a good idea of the status of 0004 before proceeding further with the next one. However, given that these changes are so extensive, I think it might be better to review 0004+0005 squashed as one unit, rather than separately. > For REPACK, I suggest a variant of toast_flatten_tuple() that writes the > output to a file, and a corresponding function that reads it while allocating > separate chunks of memory for the individual TOASTed attributes - the restored > tuple would reference the chunks using the "external indirect" TOAST pointers, > as if it had been processed by ReorderBufferToastReplace(). Does that make > sense to you? Hmm, so on the apply side when reading the file, we would first reach each toast attribute value, which we know to insert directly to the toast table (keeping track of each individually toast pointer as we do so); then we reach the heap tuple itself, we [... somehow ...] interpret these external indirect toast pointers and substitute the toast pointers that we created. So we never have to construct the entire tuple, or indeed do anything else with the toasted values other than insert them into the toast table. Actually, can't we simply insert the toasted values directly in the decoding worker into the new toast table? That could save a lot of writing to the file, since we only save the raw heap tuples with no toasted contents; but it's not clear to me that this is valid. (And we might create extra bloat if a tuple is inserted and later deleted concurrently with the repack; but that would happen with the original approach as well, no?) -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "We’ve narrowed the problem down to the customer’s pants being in a situation of vigorous combustion" (Robert Haas, Postgres expert extraordinaire)