Re: Limit clause not using index - Mailing list pgsql-performance

From Tom Lane
Subject Re: Limit clause not using index
Date
Msg-id 17468.1119388807@sss.pgh.pa.us
Whole thread Raw
In response to Re: Limit clause not using index  (Tobias Brox <tobias@nordicbet.com>)
Responses Re: Limit clause not using index  (Tobias Brox <tobias@nordicbet.com>)
List pgsql-performance
Tobias Brox <tobias@nordicbet.com> writes:
> [John A Meinel - Tue at 10:14:24AM -0500]
>> I believe if you drop the indexes inside a transaction, they will still
>> be there for other queries, and if you rollback instead of commit, you
>> won't lose anything.

> Has anyone tested this?

Certainly.  Bear in mind though that DROP INDEX will acquire exclusive
lock on the index's table, so until you roll back, no other transaction
will be able to touch the table at all.  So the whole thing may be a
nonstarter in a production database anyway :-(.  You can probably get
away with
    BEGIN;
    DROP INDEX ...
    EXPLAIN ...
    ROLLBACK;
if you fire it from a script rather than by hand --- but EXPLAIN
ANALYZE might be a bad idea ...

            regards, tom lane

pgsql-performance by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Limit clause not using index
Next
From: PFC
Date:
Subject: Re: Querying 19million records very slowly