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 1i4MRb-0004Uv-K6 for pgsql-bugs@arkaria.postgresql.org; Sun, 01 Sep 2019 09:46:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i4MRZ-0007sX-HS for pgsql-bugs@arkaria.postgresql.org; Sun, 01 Sep 2019 09:46:45 +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 1i4MRZ-0007sQ-7Q for pgsql-bugs@lists.postgresql.org; Sun, 01 Sep 2019 09:46:45 +0000 Received: from courriel.mines-paristech.fr ([77.158.173.149] helo=antispam-1.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i4MQp-0005dM-HT for pgsql-bugs@lists.postgresql.org; Sun, 01 Sep 2019 09:46:43 +0000 Received: from smtp-4.mines-paristech.fr (smtp-4.ensmp.fr [77.158.173.143]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by antispam-1.ensmp.fr (antispam.mines-paristech.fr) with ESMTPS id E551755E92; Sun, 1 Sep 2019 11:45:55 +0200 (CEST) Received: from lancre (177.161.99.84.rev.sfr.net [84.99.161.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-4.mines-paristech.fr (Postfix) with ESMTPSA id B06BA2C0090; Sun, 1 Sep 2019 11:45:55 +0200 (CEST) Date: Sun, 1 Sep 2019 11:45:50 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@lancre To: Michael Paquier cc: hellojo180@yahoo.es, PostgreSQL Bugs Subject: Re: BUG #15987: Improve REINDEX of all indexes of a table at once In-Reply-To: <20190901043534.GA3190@paquier.xyz> Message-ID: References: <15987-7d85883d9674a15e@postgresql.org> <20190901043534.GA3190@paquier.xyz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-201920451-1567331155=:29429" X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrudeikedgudelucetufdoteggodetrfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvufgjkfhffgggtgesmhdtreertderjeenucfhrhhomhephfgrsghivghnucevqffgnffjqfcuoegtohgvlhhhohestghrihdrvghnshhmphdrfhhrqeenucfkphepkeegrdelledrudeiuddrudejjeenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-201920451-1567331155=:29429 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT >> 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, […] I understood the request as the scan should be factored out, so that reindexing a table with multiple indexes would cost only one seq scan. -- Fabien. --8323329-201920451-1567331155=:29429--