Re: Not Picking Index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gauri Kanekar" <meetgaurikanekar(at)gmail(dot)com>
Cc: "Michael Fuhr" <mike(at)fuhr(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Not Picking Index
Date: 2007-02-16 14:53:45
Message-ID: 21263.1171637625@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Gauri Kanekar" <meetgaurikanekar(at)gmail(dot)com> writes:
> I want the planner to ignore a specific index.
> I am testing some query output. For that purpose i dont want the index.
> I that possible to ignore a index by the planner.

begin;
drop index soandso;
explain analyze ...;
rollback;

Note the DROP INDEX will acquire exclusive lock on the table, so this
might not be the greatest thing to do in a production environment.
In PG 8.2 and up there is a sneakier way to do it that won't acquire
any more lock than the statement-under-test does:

begin;
update pg_index set indisvalid = false
where indexrelid = 'soandso'::regclass;
explain analyze ...;
rollback;

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mike Gargano 2007-02-16 16:06:57 Fwd: Not Picking Index
Previous Message Alvaro Herrera 2007-02-16 14:46:39 Re: Not Picking Index