Re: Force specific index disuse

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Force specific index disuse
Дата
Msg-id 674.1400612126@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Force specific index disuse  (Steve Crawford <scrawford@pinpointresearch.com>)
Список pgsql-general
Steve Crawford <scrawford@pinpointresearch.com> writes:
> On 05/20/2014 10:44 AM, Alvaro Herrera wrote:
>> If you can afford to lock the table for a while, the easiest is
>>
>> BEGIN;
>> DROP INDEX bothersome_idx;
>> EXPLAIN your_query;
>> ROLLBACK;

> Interesting. But what do you mean by "a while?" Does the above keep the
> index intact (brief lock) or does it have to rebuild it on rollback?

The index doesn't need to be rebuilt; the transaction need take only
as long as your EXPLAIN does.

> What would happen if you did:
> BEGIN;
> DROP INDEX bothersome_idx;
> INSERT INTO indexed_table...;
> ROLLBACK;

The INSERT would insert a tuple lacking any entry in bothersome_idx,
but it doesn't matter since it'll get rolled back.

            regards, tom lane


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

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: Force specific index disuse
Следующее
От: David G Johnston
Дата:
Сообщение: Re: Force specific index disuse