pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gauri Kanekar <meetgaurikanekar@gmail.com>
Cc: Michael Fuhr <mike@fuhr.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: Not Picking Index
Date: Fri, 16 Feb 2007 09:53:45 -0500
Message-ID: <21263.1171637625@sss.pgh.pa.us> (raw)
In-Reply-To: <7e4ba9550702160631j5b428addr199bd87bd0704dc3@mail.gmail.com>
References: <7e4ba9550702160456m6e86e809oc35dd68620348c80@mail.gmail.com>
	<20070216142804.GA44536@winnie.fuhr.org>
	<7e4ba9550702160631j5b428addr199bd87bd0704dc3@mail.gmail.com>

"Gauri Kanekar" <meetgaurikanekar@gmail.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



view thread (10+ messages)  latest in thread

Message-ID: <21263.1171637625@sss.pgh.pa.us>
Permalink:  ../21263.1171637625@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21263.1171637625@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, meetgaurikanekar@gmail.com, mike@fuhr.org
  Subject: Re: Not Picking Index
  In-Reply-To: <21263.1171637625@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox