Re: Force specific index disuse - Mailing list pgsql-general

From Tom Lane
Subject Re: Force specific index disuse
Date
Msg-id 674.1400612126@sss.pgh.pa.us
Whole thread Raw
In response to Re: Force specific index disuse  (Steve Crawford <scrawford@pinpointresearch.com>)
List 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 by date:

Previous
From: Steve Crawford
Date:
Subject: Re: Force specific index disuse
Next
From: David G Johnston
Date:
Subject: Re: Force specific index disuse