pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: How to force PostgreSQL using an index
Date: Wed, 15 Feb 2006 17:06:56 -0500
Message-ID: <20060215220656.GF6562@phlogiston.dyndns.org> (raw)
In-Reply-To: <1E293D3FF63A3740B10AD5AAD88535D2019091DC@UBIMAIL1.ubisoft.org>
References: <1E293D3FF63A3740B10AD5AAD88535D2019091DC@UBIMAIL1.ubisoft.org>

On Wed, Feb 15, 2006 at 04:58:54PM -0500, Daniel Caune wrote:
> Hi,
> 
>  
> 
> Is there a way to force PostgreSQL using an index for a SELECT
> statement?  I just want to confirm that the index PostgreSQL decides to
> use is better than the index I supposed PostgreSQL would use (I already
> analyze the table).

Your best bet is to do 

set enable_indexscan=false;

and then do the EXPLAIN ANALYSE for your select.

You might also find that fiddling with other settings affects the
planner's idea of what would be a good plan.  The planner is
sensitive to what it thinks it knows about your environment.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
If they don't do anything, we don't need their acronym.
		--Josh Hamilton, on the US FEMA



view thread (11+ messages)  latest in thread

Message-ID: <20060215220656.GF6562@phlogiston.dyndns.org>
Permalink:  ../20060215220656.GF6562@phlogiston.dyndns.org/
Also on:    postgresql.org/message-id/20060215220656.GF6562@phlogiston.dyndns.org

 · 

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: ajs@crankycanuck.ca
  Subject: Re: How to force PostgreSQL using an index
  In-Reply-To: <20060215220656.GF6562@phlogiston.dyndns.org>

* 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