Re: BUG #15987: Improve REINDEX of all indexes of a table at once

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: hellojo180(at)yahoo(dot)es, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15987: Improve REINDEX of all indexes of a table at once
Date: 2019-09-01 04:35:34
Message-ID: 20190901043534.GA3190@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Fabien COELHO 2019-09-01 09:45:50 Re: BUG #15987: Improve REINDEX of all indexes of a table at once
Previous Message Tom Lane 2019-08-31 19:40:18 Re: psql should re-read connection variables after connection reset