From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rural Hunter <ruralhunter@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: how to change the index chosen in plan?
Date: Fri, 08 Jun 2012 10:10:58 -0400
Message-ID: <11881.1339164658@sss.pgh.pa.us> (raw)
In-Reply-To: <4FD1FF14.9060303@gmail.com>
References: <4FD1FF14.9060303@gmail.com>
Rural Hunter <ruralhunter@gmail.com> writes:
> I have a query like this:
> select a.* from a inner join b on a.aid=b.aid where a.col1=33 a.col2=44
> and b.bid=8
> postgresql selected the index on a.col1 then selected the index on
> b.bid. But in my situation, I know that the query will be faster if it
> chose the index on b.bid first since there are only a few rows with
> value 8.
If you know that and the planner doesn't, maybe ANALYZE is called for.
regards, tom lane
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, ruralhunter@gmail.com
Subject: Re: how to change the index chosen in plan?
In-Reply-To: <11881.1339164658@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