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 1w9rET-001pY2-2i for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 21:11:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9rEQ-00C3Ws-2R for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 21:11:39 +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 1w9rEP-00C3Wk-2Q for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 21:11:38 +0000 Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9rEM-00000000xzl-1Inb for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 21:11:37 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id B5178EC0425; Mon, 6 Apr 2026 17:11:31 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Mon, 06 Apr 2026 17:11:31 -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=1775509891; x=1775596291; bh=PYTMxb7eME oBa+9wUz1hBYcW3WZv4B33y606AXkksPo=; b=Lrab3UQFRYr4DvFXcUasJQs22J c8SnaJ5JEZuJDWybCrcx0A+praueKnX7NN15uc2RYflD0nLdzE4br+jnxIA3dXAv kpY+azFRs6q2DEAOCve1QvLvAA+2nVaCtwo+UWSyVhseIUf+ecb+FUKG2NolsxZD O6D0bG1O9XJg76Mp+XX4CmYCJF5ysy3AvDRzyqPHPq/G436m9ExG0aJwEZhKNhLM oqHFSZH2EqmeeB+l+A7eqXR2iTpx7eFKPS0IbXDkVedrQEqbun7Jz3KgH5pN3fKS OB5g0szcYeNEotEkAjhbcgzSETaMHX2kHajjx/Ow2xuyRjEfMTE/IqpXThtg== 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= 1775509891; x=1775596291; bh=PYTMxb7eMEoBa+9wUz1hBYcW3WZv4B33y60 6AXkksPo=; b=BzN8/Z6qor5MS9p02dXri1VifBceRoVUxgmDoH0lScQnBvPfvyn 9zdRhtbzY4EVnry3znOda0gE2fllTW0rsswDzyCeAP+YwtcwHk/q4LpgPtM8HF7Q WRFD9qpNFsWtLN7LNc6HpOdG5SuxVeRLjMPobV0THDq4Zksc+2y+u3klL9iZJfg7 nYkNCB8H3vCVn3gsC8EynjH7Lk7o2gDETbcqnyzWcDeiA/FFh7J0vEc5nblEiTrs HAbooXZOJIFKPwn725c2nyX9jSIm5iXG1BNOhDn7YRq2kPwvi2ae4bx0j29hiLau 0Q8oBxy7GyaLKGrPHdIl8X8uVeL8couOljA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddukeejlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecuhfhrohhmpeetnhgurhgvshcu hfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrghtth gvrhhnpeeffffgledvffegtdevlefgtdeggffhvdekgfegteeiveejkeetudelveejhfeu geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnh gurhgvshesrghnrghrrgiivghlrdguvgdpnhgspghrtghpthhtohepuddtpdhmohguvgep shhmthhpohhuthdprhgtphhtthhopegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprd horhhgpdhrtghpthhtoheprghhsegthigsvghrthgvtgdrrghtpdhrtghpthhtoheprghm ihhtrdhkrghpihhlrgduieesghhmrghilhdrtghomhdprhgtphhtthhopegsohgvkhgvfi hurhhmodhpohhsthhgrhgvshesghhmrghilhdrtghomhdprhgtphhtthhopehmihhhrghi lhhnihhkrghlrgihvghusehgmhgrihhlrdgtohhmpdhrtghpthhtohepshhrihhnrghthh dvudeffeesghhmrghilhdrtghomhdprhgtphhtthhopehvihhgnhgvshhhvddusehgmhgr ihhlrdgtohhmpdhrtghpthhtohepnhhorghhsehlvggruggsohgrthdrtghomhdprhgtph htthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdr ohhrgh X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Apr 2026 17:11:30 -0400 (EDT) Date: Mon, 6 Apr 2026 17:11:30 -0400 From: Andres Freund To: Alvaro Herrera , Noah Misch Cc: vignesh C , Antonin Houska , Srinath Reddy Sadipiralla , Amit Kapila , Mihail Nikalayeu , Matthias van de Meent , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] Message-ID: References: <202604060918.qw5ms7cbr2hz@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202604060918.qw5ms7cbr2hz@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I just saw this got committed and wanted to briefly play with it. It works nicely! Except that at first I tried this in a debugging build, and was briefly rather dismayed by the performance. It was really slow. But it's not really related to repack / the patches here. Turns out that it is to a good part due to heap_insert() ->CacheInvalidateHeapTuple() ->CacheInvalidateHeapTupleCommon() ->AssertCouldGetRelation() not being cheap and running a *lot*. Admittedly it's way worse if you build with -O0, which I tend to do to make debugging easier. In that config, the assert single-handled increases the time for a repack by 35% or so. Noah, is there any reason we need to do the AssertCouldGetRelation() before the !IsCatalogRelation(relation)? Given that the goal is to make RelationGetRelid() safe, it doesn't seem there is? It's totally valid to not have done so initially, this is a quite complicated feature: I saw this is using individual heap_insert()s during the heapam_relation_copy_for_cluster(). Doing individual WAL logged inserts isn't exactly cheap or efficient from a WAL volume perspective... Is there anything other than round tuits preventing us from using multi_insert? That actually would also reduce the cost in the REPACK decoding worker, due to having to parse far fewer WAL records. Greetings, Andres Freund