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 1i4RvC-0005uY-Gj for pgsql-bugs@arkaria.postgresql.org; Sun, 01 Sep 2019 15:37:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i4RuB-0005Xv-FQ for pgsql-bugs@arkaria.postgresql.org; Sun, 01 Sep 2019 15:36:39 +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 1i4RuB-0005Xo-4q for pgsql-bugs@lists.postgresql.org; Sun, 01 Sep 2019 15:36:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i4Ru8-0008Mf-Ii for pgsql-bugs@lists.postgresql.org; Sun, 01 Sep 2019 15:36:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x81FaPu0031842; Sun, 1 Sep 2019 11:36:25 -0400 From: Tom Lane To: Fabien COELHO cc: Michael Paquier , hellojo180@yahoo.es, PostgreSQL Bugs Subject: Re: BUG #15987: Improve REINDEX of all indexes of a table at once In-reply-to: References: <15987-7d85883d9674a15e@postgresql.org> <20190901043534.GA3190@paquier.xyz> Comments: In-reply-to Fabien COELHO message dated "Sun, 01 Sep 2019 11:45:50 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <31840.1567352185.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sun, 01 Sep 2019 11:36:25 -0400 Message-ID: <31841.1567352185@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Fabien COELHO writes: >> 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. I'm not totally convinced that that would be an improvement. For starters, one would presumably have to divide up maintenance_work_mem per index, which would be a substantial penalty for some index types. Also, you'd be creating more randomized I/O on the index-writing side of the equation (for those index types that write the index during the scan). It might net out as a win anyway depending on context, but I don't think it's as clear-cut as the OP seems to think. regards, tom lane