Re: REINDEX and blocking SELECT queries

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: REINDEX and blocking SELECT queries
Дата
Msg-id 19413.1473428496@sss.pgh.pa.us
обсуждение исходный текст
Ответ на REINDEX and blocking SELECT queries  (Satoshi Nagayasu <snaga@uptime.jp>)
Ответы Re: REINDEX and blocking SELECT queries  (Vik Fearing <vik@2ndquadrant.fr>)
Re: REINDEX and blocking SELECT queries  (Satoshi Nagayasu <snaga@uptime.jp>)
Список pgsql-docs
Satoshi Nagayasu <snaga@uptime.jp> writes:
> According to the manual, running REINDEX does not take any locks
> on the parent table which block read operations.
> Actually, REINDEX blocks SELECT queries, maybe in the planning phase.

Hm.  REINDEX does take out only ShareLock on the table, which would not
block DML, but it takes out AccessExclusiveLock on the index.  That
blocks the planner's attempts to acquire information about the table's
indexes.

In the case of an update query I think there's little we can do about
this; the executor would have to update the index anyway.  For a pure
SELECT, you could imagine having the planner do a conditional lock acquire
and ignore the index if that fails.  Would that be better than blocking?
Not sure.  You could end up with a really bad plan if the index was
critical for efficient processing of the query.

            regards, tom lane


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

Предыдущее
От: Satoshi Nagayasu
Дата:
Сообщение: REINDEX and blocking SELECT queries
Следующее
От: Vik Fearing
Дата:
Сообщение: Re: REINDEX and blocking SELECT queries