Re:

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re:
Дата
Msg-id 20200528065559.GB3460@paquier.xyz
обсуждение исходный текст
Ответ на Re[4]:  (Andrey Klychkov <aaklychkov@mail.ru>)
Список pgsql-bugs
On Wed, May 27, 2020 at 03:10:18PM +0300, Andrey Klychkov wrote:
> I got the error related to the one UNIQUE index, why all the new indexes are invalid?
> It would be good:
> *  if other indexes are possible to rebuild, reindexdb rebuilds them
> *  if not (why?), reindexdb reports why

When you use reindexdb for a database, the tool launches actually a
REINDEX DATABASE that does a reindex for all tables, one-by-one,
launching one transaction for each table reindexed.  REINDEX
CONCURRENTLY is a multi-step process consisting in the following:
- Create an index definition which is a copy of the index to rebuild.
- Build the index.
- Validate the index.
- Switch dependencies of the old and new indexes.
- Drop the old index.

And the main point is that when doing a table-level REINDEX, all the
steps above are applied to all the indexes of a relation
one-at-a-time.  Hence, if you have N indexes on a table, REINDEX
CONCURRENTLY first creates N new cloned indexes, then it builds N
indexes, it validates N indexes, etc.  The reason why you see this
many invalid indexes is that you have a failure at build phase,
meaning that all the other indexes did not reach yet the stage where
they are valid to be used (indisvalid is changed when dependencies are
swapped to be precise), so a failure causes the creation of a set of
invalid indexes, associated with the table previously reindexed.
--
Michael

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #16468: Doc: release note 13, missing GUC enable_groupingsets_hash_disk
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Re[2]: