pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Owen Jacobson <ojacobson@osl.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to force PostgreSQL using an index
Date: Wed, 15 Feb 2006 18:02:47 -0500
Message-ID: <20580.1140044567@sss.pgh.pa.us> (raw)
In-Reply-To: <144D12D7DD4EC04F99241498BB4EEDCC220865@nelson.osl.com>
References: <144D12D7DD4EC04F99241498BB4EEDCC220865@nelson.osl.com>

"Owen Jacobson" <ojacobson@osl.com> writes:
> On Wed, Feb 15, 2006 at 04:58:54PM -0500, Daniel Caune wrote:
>> I see, but that doesn't explain whether it is possible to specify the
>> index to use.  It seems that those options just force PostgreSQL using
>> another plan.

> Drop the simple index and re-create it when you're done?

BTW, the cute way to do that is

	BEGIN;
	DROP INDEX unwanted;
	EXPLAIN ANALYZE whatever...;
	ROLLBACK;

No need to actually rebuild the index when you are done.

This does hold an exclusive lock on the table for the duration of your
experiment, so maybe not such a good idea in a live environment ... but
then again, dropping useful indexes in a live environment isn't a good
idea either, and this at least reduces the duration of the experiment by
a good deal.

			regards, tom lane



view thread (11+ messages)  latest in thread

Message-ID: <20580.1140044567@sss.pgh.pa.us>
Permalink:  ../20580.1140044567@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20580.1140044567@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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ojacobson@osl.com
  Subject: Re: How to force PostgreSQL using an index
  In-Reply-To: <20580.1140044567@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