Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i4Hap-0003n3-9g for pgsql-bugs@arkaria.postgresql.org; Sun, 01 Sep 2019 04:36:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i4Ham-0004Gz-5p for pgsql-bugs@arkaria.postgresql.org; Sun, 01 Sep 2019 04:35:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i4Hak-0004Dh-AD for pgsql-bugs@lists.postgresql.org; Sun, 01 Sep 2019 04:35:55 +0000 Received: from [66.111.4.25] (helo=out1-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i4Hag-0002Kc-Re for pgsql-bugs@lists.postgresql.org; Sun, 01 Sep 2019 04:35:52 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 34FE121C29; Sun, 1 Sep 2019 00:35:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sun, 01 Sep 2019 00:35:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=d9nubg36MdspSAndClb+99nNkkp DTLf76N4fUjr/zWs=; b=ZK26US9EIR8u3mEeeX86Efaaq7j4tgq4KfLdy7MR62Q GhiPMzVY/QqEeus9wYCTtyWVNYskQzaMD48hUQX0nufaNppbr13tOT6IRFZaikj5 MYjuirgoJLmAB8f8h+a3mI7MXUtwtmGnUM/UzXPLTqGo38KzhpLNH7di3YkBiQYw d62Xx9vMmZMRha7mvHRQ8zVsO9N6zn8C/fLkP/UNWXj6T5hIfj1cAaRwPvBdK1+Z Ox7T2utxvPphVpYc5avoekOyuW7gdvT5AbtHw4OEENTgFBsZ3gTbx4OiI15gBC5n wcbn4UqcH054LfrQQZhBTXW3oqfZQRCwJPWwU2gkl4A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=fm3; bh=d9nubg 36MdspSAndClb+99nNkkpDTLf76N4fUjr/zWs=; b=SGf+BCRXHbBf29X/lfe4gC WUKgWUDrFa4Mk8y+erkzbDfMA0O/OVNJSchd1lMYAvdpkTRge3reKTBHs7SnfMqI 2Z6iEU3lHI6lTGCHZnMQZ5UmHqWX79BBoKRfp3EGEJNSjbosW9By7HKfOajwYIwx O//StQe8Kg2Ouh2eBba8GhQKcn/CP1arJaGAE0HEH5uycdNILtkrPqj0gxy4vv+f kAzQ5xKsbZ+5f/f9eTxf8sSIvo89dw1DeAvrB0M+tiarQ6UPxGG5KZyD4ZPkr6NG PArnJc6Yj8bea2lF41UlZm5z2lOBcXEDxYrZwbZfY/MNXoQJid/8mFYm52NGKGBw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudeijedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhf fvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucfkphepudduuddrud dtvddrudektddrudekheenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiienucevlhhushhtvghrufhiiigvpedt 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 C2A8680059; Sun, 1 Sep 2019 00:35:37 -0400 (EDT) Date: Sun, 1 Sep 2019 13:35:34 +0900 From: Michael Paquier To: hellojo180@yahoo.es, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15987: Improve REINDEX of all indexes of a table at once Message-ID: <20190901043534.GA3190@paquier.xyz> References: <15987-7d85883d9674a15e@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qDbXVdCdHGoSgWSk" Content-Disposition: inline In-Reply-To: <15987-7d85883d9674a15e@postgresql.org> X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Aug 31, 2019 at 05:15:10PM +0000, PG Bug reporting form wrote: > I am just spending lots of time to rebuild the indexes of our DB one by one, > although all indexes of the same table need a refresh at once, Therefore you > need to open a cursor which contains the DB-columns which occur in at least > one of the indexes. If the same columns occur in more than 1 index you need > to read them only once. Then you run 1 and only 1 full table scan (FTS), and > with the data of the cursor you add an entry into each of the indexes to > rebuild. With just 1 FTS you could create all the indexes at once, and > speeding up a full reindex task to use little more than the time the FTS > takes. I don't quite understand your request. You have REINDEX TABLE which is able to reindex all the indexes of a table one by one, REINDEX SCHEMA which works on all the tables of the defined schema, and REINDEX DATABASE which works on all the indexes within a database which processes in a serializable fashion all its tables. If you have indexes are defined multiple times for the same columns and you'd like to just process these, you may not need those multiple definitions. Please note that if you have multiple indexes on the same table which partially map to the same columns, you still need to process them one-by-one. -- Michael --qDbXVdCdHGoSgWSk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl1rSpYACgkQnvQgOdby QH1Row//S3i8s7brtcsgt2hK/KLlXrDFUtaD0WJMsTjy2d4Vm8kOfIUmu2bLW5Cn ML3WcZvwv55a2olkDDV87+OeK76luDs+7mNhylD6PfX91FRWzNnIQ2w8WOmqUDm3 VhOBtbJavd785f7PH9ivHhAUQhIC9VtVkLbQ8BfIq19E6G8WtlXr5mQZq6Ad+wBt cGtCOuzsa7/TWvh2TJZNu49f36dyFqlq7VahEwUyQG669SYykQr++A92eVra9tEl 4IwgvFXKWnqbzeGONLkuL6jv+G11hMvI9RsBUqcwEdnwTiiGBUA7waL3ujzJKZ2y B901fHTvFsY+0Yha4TaIZkybj752iLxtpyzUAxEf0yMEqCXzDnxzqrUOosZsDlg/ WZl4SXvOCGVtomq0RFUGEevQa5wYtsHu8Vg5E/XBL1p6WXVDAXA2hauza4rxc8qQ TaBsktR4NcTO8XemG5uJYPEV78BBVLO3hVEt22CXm3dWlsHFTsfryiaC2fL4YGmH fGkraScKd666USiTirNeGSw2rPraOBn+czV6VFdGrT8SaUB9/YGUTngRXE/OTEDw ZGLxD76EDbglglvFxypF8nU0MyjEL1yqlWcLQOOlv/U9g0ulug6IKcz/BrIJG0we mAt1am9EOURT6SqpPVjyPDjfih/E4RpcNFASpOVRpoUUSELyuYI= =74E7 -----END PGP SIGNATURE----- --qDbXVdCdHGoSgWSk--