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 1rXEqM-009Tqd-Ip for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Feb 2024 06:22:07 +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 1rXEqL-0014F7-N4 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Feb 2024 06:22:05 +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.94.2) (envelope-from ) id 1rXEqL-0014Ey-Ds for pgsql-hackers@lists.postgresql.org; Tue, 06 Feb 2024 06:22:05 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rXEqI-005i8d-VC for pgsql-hackers@lists.postgresql.org; Tue, 06 Feb 2024 06:22:04 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C62653200A6B; Tue, 6 Feb 2024 01:21:59 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 06 Feb 2024 01:22:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; 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=fm3; t=1707200519; x=1707286919; bh=MShkmiddk9 9+G9dAgSQ/wlInIn/2PObEG9HThGcCkbo=; b=X9wcSzVqLQfwMwHBy/+N11ScyM umnjH05y3DoBb/tIL3l+5eODZY03zs+gliVgjmBcgYJQmG+I6GnMLx6WWS8DK8Qt m4wl/JlSEdZO3z7Q3NdSlFXbfZLqOra+SpEJAdObbV3WCVMjYCV8fStrl4Hm8jmN gRyMHVIpt6W80hDlZpNxuTqEo3kcyc8o0GY8LAAJ0uxvySBBns7eVWx7Ny6hPzEd +BeLSjYFozzBzwfBJQR3xhn5rmkLhKtSiyOScG7dK3LQXLLRmvFTzaQ1BDYe0703 6pvPiIpp1kjwDh8k4PNsvheQXvsX+GtiH/Pb6GNOkIgxEW8qhyTP5YN4h7zA== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1707200519; x=1707286919; bh=MShkmiddk99+G9dAgSQ/wlInIn/2 PObEG9HThGcCkbo=; b=XR9eZ9tA5vBHI8Nh6jyW+C1Z21weKBnHfXj3jL3k2nkY 1RCaWvxI2UWKgDzb4okKlmbAzEv6b7oc8gCRVnqSgT2hlLFpscferejQnNZ2KxKf GZeYKtDl8Fgsw+auILG16EuKQNn+sSah6izj6H5t6KUBaCWhDG4bSgYy2kxEyQIw ynPfNVg6ggipp6qM70ndmmC1tonwJm5lf2PEaZ+kEIiyPhpLIv4o9ZGTeEJc+n0l edrEWoAZTiJ6/EGs4tCrnAppqpUtRe6lXQNPmKIQ84VeFLKH2/SdAmYhU36vMLco sJV44udcIoXbtqtZFxxXdaPVx/1y4WiueZ6C6XK2vg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedvvddgleejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 6 Feb 2024 01:21:57 -0500 (EST) Date: Tue, 6 Feb 2024 15:21:48 +0900 From: Michael Paquier To: Maxim Orlov Cc: Postgres hackers Subject: Re: Add Index-level REINDEX with multiple jobs Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Gx0Q9ibEqBH0HdFK" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Gx0Q9ibEqBH0HdFK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Dec 29, 2023 at 04:15:35PM +0300, Maxim Orlov wrote: > Recently, one of our customers came to us with the question: why do reindex > utility does not support multiple jobs for indices (-i opt)? > And, of course, it is because we cannot control the concurrent processing > of multiple indexes on the same relation. This was > discussed somewhere in [0], I believe. So, customer have to make a shell > script to do his business and so on. Yep, that should be the correct thread. As far as I recall, one major reason was code simplicity because dealing with parallel jobs at table level is a no-brainer on the client side (see 0003): we know that relations with physical storage will never interact with each other. > But. This seems to be not that complicated to split indices by parent > tables and do reindex in multiple jobs? Or I miss something? > PFA patch implementing this. + appendPQExpBufferStr(&catalog_query, + "WITH idx as (\n" + " SELECT c.relname, ns.nspname\n" + " FROM pg_catalog.pg_class c,\n" + " pg_catalog.pg_namespace ns\n" + " WHERE c.relnamespace OPERATOR(pg_catalog.=) ns.oid AND\n" + " c.oid OPERATOR(pg_catalog.=) ANY(ARRAY['\n"); The problem may be actually trickier than that, no? Could there be other factors to take into account for their classification, like their sizes (typically, we'd want to process the biggest one first, I guess)? -- Michael --Gx0Q9ibEqBH0HdFK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmXBz/sACgkQnvQgOdby QH2hLA//QVIA7iWQo6iV+R0OoJVwHp7aiupYsKF/2VXEBqQKTsyNrvQWEPIImDU0 gI/WQZgtU5hay60toQIEa/CbF/F1Ya2YU5AxHteb1j5ysYPZixn79iOU1Q7JJQeZ tKGV5ySA8ZyZflFGLX/HcmOUKlp094Lg4MuIqtPRLtt3pOdUIYztktFwCtMin6EN 98k5c/kdRyfXeA7aPUG7VHN1ULymKxDeiEb5a2YbS9jqMkOX2dG4mMwtK19tRDJ1 yi+7AXDogRcZcyyeRVfASsKZyVAlS76LzemuCQ4Exbv8hO7MH9K16lmUaj0mA5yB G+FOfyHyDkYs7mo6Twueb0gk5Eyby1wyhN6TwB5W/5YdPQlrb6bVQC+y52nbGwKP iLnT0FJKmBJHGHc9RMb3ROq/NhMFTb4vvnXDKSFVBqrJVc+9GmPJxr/5w//eOLP8 ewWEhIwx7uUaVrC10iKpcnbmwU/Kh5f0cM+/FQMYDSvZUH8WhId94Rdvpo5tHSbu VQbrMSFfaQtclpnTozm4fDkSWu3qS86lbQ/wm65IqEd1Sm+OfHJMBIGTzzpsnZ8g 8kroxEE5kkBiGAn+FvtO5XSroIEEtBXU4bvPsVexkvLo0ptiR2U/oBw8COkhhHPu IjgNWFkKyLKPIT84su+j7TeUD+Xto/7qZGTOAvG1gR1osrLJRmM= =N0KS -----END PGP SIGNATURE----- --Gx0Q9ibEqBH0HdFK--