Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpKfq-0004cQ-EH for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Dec 2020 00:28:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kpKfo-0003vh-9R for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Dec 2020 00:28:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpKfm-0003va-LR for pgsql-hackers@lists.postgresql.org; Wed, 16 Dec 2020 00:28:07 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpKff-0004En-OR for pgsql-hackers@lists.postgresql.org; Wed, 16 Dec 2020 00:28:05 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id E820E5C0167; Tue, 15 Dec 2020 19:27:57 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 15 Dec 2020 19:27:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=rS9cLg0tV+as/ysiq8Piv0Fm4tG /NtHBEjOC/nQ7nLM=; b=TgKluXbP0OxwlOUL8g4lsxObEjNelo6MiQAh4hgmmOM 7YsLBESZ3hthxZU4OPGmYarZ5h4CNUVLWKU21PgcYqeCWlJo3mCri/wKhFd+9D4R a+IApsJVRwxRog8yYl8FXlXUZqHncUD+bPmDK00JQk+km3fd4kzCImxxb+aZTt9N 7ybZwRRjA13aKmNM8Fc1jZ9V8jFja5b3IrEB/+E6ax0VR4auP/Bcr89FsNwExfnn Nclnm6opWuJ2SsAXFWXg5N14XZtdbsHX96x7WQ27QygQCY4alm++BYwH7+MUWK+5 +HkjC/4/B9lT8X605krNJqCQZyxZdSZIlZl9TzJIU4w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=rS9cLg 0tV+as/ysiq8Piv0Fm4tG/NtHBEjOC/nQ7nLM=; b=FeMqmUOnHbBndrMAWXFFTz NWvAxwZsxwVqFV7Xrr9mF57cBGPPM+VkQjGX+crkvDEoVHt5MfIi2CXn0cfMjtlN TJjTx8vD9V6vmbl0e58tU5XT+JQw09rRffzIBCaEM44bAkua1fNy2kyk/YnRuoF5 7GbxRU1GDb0+fjeYrJ6P11Us0MFQZRBO2117IiswrxNdWxqDIwLwIxDVFAXh06pN KjAWFJmKIHWgoTS24M/JlcKGl4C5ac/5l9w58To9idQtyj9WxPohqRHN9FU/Jl4X pkLEPZF1ItZ6Ym5FtMiSeXXu8yiZ7dSuh+Qep6wvamsVDjtEEc/Z/Ryc23Xsl2bQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeluddgvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpedvgeduuefhtdeuleettdevjeeh heeiveeuieegleetgeeljeelieeuieehgeevhfenucfkphepudduuddruddtvddrudektd drudekheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 4EF0C240057; Tue, 15 Dec 2020 19:27:56 -0500 (EST) Date: Wed, 16 Dec 2020 09:27:53 +0900 From: Michael Paquier To: Magnus Hagander Cc: Julien Rouhaud , PostgreSQL Hackers Subject: Re: REINDEX backend filtering Message-ID: References: <20201203093143.GA64934@nol> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Co51fiMLKWvTiMdB" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Co51fiMLKWvTiMdB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 15, 2020 at 06:34:16PM +0100, Magnus Hagander wrote: > Is this really a common enough operation that we need it in the main gram= mar? >=20 > Having the functionality, definitely, but what if it was "just" a > function instead? So you'd do something like: > SELECT 'reindex index ' || i FROM pg_blah(some, arguments, here) > \gexec >=20 > Or even a function that returns the REINDEX commands directly (taking > a parameter to turn on/off concurrency for example). >=20 > That also seems like it would be easier to make flexible, and just as > easy to plug into reindexdb? Having control in the grammar to choose which index to reindex for a table is very useful when it comes to parallel reindexing, because it is no-brainer in terms of knowing which index to distribute to one job or another. In short, with this grammar you can just issue a set of REINDEX TABLE commands that we know will not conflict with each other. You cannot get that level of control with REINDEX INDEX as it may be possible that more or more commands conflict if they work on an index of the same relation because it is required to take lock also on the parent table. Of course, we could decide to implement a redistribution logic in all frontend tools that need such things, like reindexdb, but that's not something I think we should let the client=20 decide of. A backend-side filtering is IMO much simpler, less code, and more elegant. -- Michael --Co51fiMLKWvTiMdB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl/ZVIkACgkQnvQgOdby QH0+GA/8Conh8iZtsNJtkND+G3grmYCAkTM2hrrXXo0qhKwe76CxmdSgmCMcxjau B2W5zdV03HIqhR20s3s/n0nhA203ej98fQM7OUPKu6CdkEzJkE7EwF2gH8LDWRbf Om2p0FLPyI9ww9qsnKzV0t9tw/TcsvvQeyTs0Usw/EVfswQsd7kXZyjmYg2hBrd1 0eUHehbVfmGUpSrNUjf5PH6PzWR9IedZGKyM4ze44USo38cn8dU8bcZnvPdEx3yg CTT+uUEZ7EjnyZagXnCczaKbpQZz1y6PnO7F2BfFLT6uFLFYOrsT2acXLENnu8k2 LE+xXVEEcuwTLKS4H6RI1bp1X0H4iFBSh/6TdmVYpHUK9zLU0sL0xbbzSRf5gSZ/ UceV0cQuas38C3RVX+Y6jr3fY+AUAo25V6bnqiF5iFJ4R3pOrisKd+a0B9LweVUB +vKu+wc6KRbDThni0Yfbx7gMVHsSZrWP9CCnyN4YRJEEy5gNgjqm3rXjeHYaOocE VARAf2zS0pI0UrsIqXtAi1iykMiwVhT0kycbGx3RV48ggjvfM1MSaX+DJvtJVI/1 X+C567UuVb9iHIQ1pg5H3AqLTcnA0G80EqvxYgdnZlVcDZ0GbDbUzRmw2XWL62lJ 9Rjshre5KvZS5nJ5n65LJXbA/ONgCR6rJ+YcFCwq2rqMbikUbe0= =cYAo -----END PGP SIGNATURE----- --Co51fiMLKWvTiMdB--