Re: disabling an index without deleting it?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: disabling an index without deleting it?
Дата
Msg-id 10385.1204153217@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: disabling an index without deleting it?  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: disabling an index without deleting it?
Re: disabling an index without deleting it?
Список pgsql-performance
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Out of curiosity, couldn't any transaction using a snapshot prior to
> the commit of the DROP continue to use it (just like an uncommited
> DELETE of a row)?  The transaction doing the DROP wouldn't maintain
> it for modifications, which is fine whether it is committed or
> rolled back.  There would just be the matter of "vacuuming" the
> index out of physical existence once all transactions which could
> see it are gone.

You can't just lazily remove the index after the last xact stops using
it; there has to be an agreed synchronization point among all the
transactions.  Otherwise you could have xact A expecting the index to
contain entries from the already-committed xact B, but B thought the
index was dead and didn't bother updating it.

We might be able to do something that would shorten the length of time
that the exclusive lock is held, but AFAICS we couldn't eliminate it
altogether; and I'm unconvinced that merely shortening the interval
is worth much extra complexity.

In the particular case at hand, a planner hook to make it ignore the
index is a far better solution anyway...

            regards, tom lane

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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: disabling an index without deleting it?
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: disabling an index without deleting it?