Re: When/if to Reindex - Mailing list pgsql-performance

From Tom Lane
Subject Re: When/if to Reindex
Date
Msg-id 1759.1187972125@sss.pgh.pa.us
Whole thread Raw
In response to Re: When/if to Reindex  ("Steven Flatt" <steven.flatt@gmail.com>)
Responses Re: When/if to Reindex
List pgsql-performance
"Steven Flatt" <steven.flatt@gmail.com> writes:
>> The fly in the ointment is that after collecting the pg_index definition
>> of the index, plancat.c also wants to know how big it is --- it calls
>> RelationGetNumberOfBlocks.

> Why do we even need to consider calling RelationGetNumberOfBlocks or looking
> at the pg_class.relpages entry?  My understanding of the expected behaviour
> is that while a reindex is happening, all queries run against the parent
> table are planned as though the index isn't there (i.e. it's unusable).

Where in the world did you get that idea?

If we had a REINDEX CONCURRENTLY it might work that way.  A normal
REINDEX cannot "mark" anything because it runs within a single
transaction; there is no way that it can emit any catalog changes
that will be visible before it's over.

            regards, tom lane

pgsql-performance by date:

Previous
From: "Steven Flatt"
Date:
Subject: Re: When/if to Reindex
Next
From: "Luke Lonergan"
Date:
Subject: Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1