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.94.2) (envelope-from ) id 1v7DqT-00GxNj-Md for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Oct 2025 14:11:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v7DqQ-00CTTM-BC for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Oct 2025 14:11:43 +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.94.2) (envelope-from ) id 1v7DqP-00CTSz-9x for pgsql-hackers@lists.postgresql.org; Fri, 10 Oct 2025 14:11:42 +0000 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1v7DqL-00135p-28 for pgsql-hackers@lists.postgresql.org; Fri, 10 Oct 2025 14:11:41 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 848AD14000F3; Fri, 10 Oct 2025 10:11:36 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Fri, 10 Oct 2025 10:11:36 -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=fm2; t=1760105496; x=1760191896; bh=z MVrk+ziIrB+Uk5oDIlEs2SdG5flYA4iRnNQRBmVkJA=; b=SVKVCa9E8buqrtonG tEaRDDkxOE8CTFvS3qVZaWjqJooLTc9ZiBd4op2MnvOsyW197nlOmWLPV7EPUmA6 IGeqVJ698fVQDL+TMM/zOZ8bJG5W236bAFasrizGLzHL+CeBXoO9+pqxHV2ajU3Y OK/J9oG2PPZaZvGUb9ggErAGAazcnW5QDLTgQQ0dRPEkyU4FFtzIrX7O/sM/eby3 0/XWBxF8SJo6Mxz+jJZvlEVX4joBCvJ0//U2KCObXUaBZayo8dXMPvW9Q/C4NvFY +aR3rtsyRvDDHBV7BmMBhLAEypi/t+eHuOuRhWxlkOgv/XiFFU2TSKWIeQ58uTfK Nuz6A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddutdelvdeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesmhekreertddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepudelkeekgfdttdettdekgfduvdeiffelteegjeeihfetheek veeftedtuddvhfeunecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsggprhgtphhtthhopedvpdhmohguvg epshhmthhpohhuthdprhgtphhtthhopegrhhestgihsggvrhhtvggtrdgrthdprhgtphht thhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdroh hrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 10 Oct 2025 10:11:35 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1760105492; bh=xVYeQ8mvL6XI8TNn7mjENJxSXR264s7AyvudDX0gU7E=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=o6N22fnb3+0np1xTensOoly1QoZbU6JlzckH0JkBMdupYiXkCadoSWe653276AoES zyhz1tXnQrbEXLD56b0n+fWQ4gkxZLMCoObirxpP5uChM/dHjrx9mOVznWUqgt5m8f UqXhR2BUTyZcciq8G6SktIT3FkSOZs2CqOJitZAMViSJnLygSZaDK4dgks/nDUQZZG iRYjEIscFjjrufHXdyl6w9bi+ffx+0caecK2LmMtyzZJqCG0dr0fx/m1uuNt6703vQ 4cufgnMMfi+SxJLjRI3fzSv5b7WlsI68BPF5ayubgv26DDLlIXm/rv++l9O+3BZjBo J0jzPlZ+bLgGA== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id DFE1B57; Fri, 10 Oct 2025 16:11:32 +0200 (CEST) Date: Fri, 10 Oct 2025 16:11:32 +0200 From: Alvaro Herrera To: Pg Hackers Cc: Antonin Houska Subject: Re: Adding REPACK [concurrently] Message-ID: <202510101352.vvp4p3p2dblu@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="sm6wwjwl24kwg5xb" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202507262156.sb455angijk6@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --sm6wwjwl24kwg5xb Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hello, Here's patch v24. I was hoping to push this today, but I think there were too many changes from v23 for that. Here's what I did: - pg_stat_progress_cluster is no longer a view on top of the low-level pg_stat_get_progress_info() function. Instead, it's a view on top of pg_stat_progress_repack. The only change it applies on top of that one is change the command from REPACK to one of VACUUM FULL or CLUSTER, depending on whether an index is being used or not. This should keep the behavior identical to previous versions. Alternatively we could just hide rows where the command is REPACK, but I don't think that would be any better. This way, we maintain compatibility with tools reading pg_stat_progress_cluster. Maybe this is useless and we should just drop the view, not sure, we can discuss separately. - pg_stat_progress_repack itself now shows the command. Also I got rid of the separate enum values for the command, and instead used the values from the parse node (RepackCommand); this removes about a dozen lines of C code. To forestall potentially bogus usage of value 0, I made the enum start from 1. - I noticed that you can do "CLUSTER pg_class ON some_index" and it will happily modify pg_index.indisclustered, which is a bit weird considering that allow_system_table_mods is off -- if you later try ALTER TABLE .. SET WITHOUT CLUSTER, it won't let you. I think this is bogus and we should change it so that CLUSTER refuses to change the clustered index on a system catalog, unless allow_system_table_mods is on. However, that would be a change from longstanding behavior which is specifically tested for in regression tests, so I didn't do it. We can discuss such a change separately. But I did make REPACK refuse to do that, because we don't need to propagate bogus historical behavior. So REPACK will fail if you try to change the indisclustered index, but it will work fine if you repack based on the same index as before, or repack with no index. - pg_repackdb: if you try with a non-superuser without specifying a table name, it will fail as soon as it hits the first catalog table or whatever with "ERROR: cannot lock this table". This is sorta fine for vacuumdb, but only because VACUUM itself will instead say "WARNING: cannot lock table XYZ, skipping", so it's not an error and vacuumdb keeps running. IMO this is bogus: vacuumdb should not try to process tables that it doesn't have privileges to. However, not wanting to change longstanding behavior, I left that alone. For pg_repackdb, I added a condition in the WHERE clause there to only fetch tables that the current user has MAINTAIN privilege over. Then you can do a "pg_repackdb -U foobar" and it will nicely process the tables that that user is allowed to process. We can discuss changing the vacuumdb behavior separately. - Added some additional tests for pg_repackdb and REPACK. - Updated the docs. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ --sm6wwjwl24kwg5xb Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="v24-0001-Add-REPACK-command.patch" Content-Transfer-Encoding: 8bit