Re: Limit clause not using index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tobias Brox <tobias(at)nordicbet(dot)com>
Cc: John A Meinel <john(at)arbash-meinel(dot)com>, Yves Vindevogel <yves(dot)vindevogel(at)implements(dot)be>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Limit clause not using index
Date: 2005-06-21 21:20:07
Message-ID: 17468.1119388807@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Tobias Brox <tobias(at)nordicbet(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message PFC 2005-06-21 21:33:30 Re: Querying 19million records very slowly
Previous Message Kevin Grittner 2005-06-21 21:11:40 Re: Limit clause not using index