Re: Query planner is using wrong index. - Mailing list pgsql-performance

From Tom Lane
Subject Re: Query planner is using wrong index.
Date
Msg-id 3544.1144379836@sss.pgh.pa.us
Whole thread Raw
In response to Re: Query planner is using wrong index.  (Brian Herlihy <btherl@yahoo.com.au>)
Responses Re: Query planner is using wrong index.  (Brian Herlihy <btherl@yahoo.com.au>)
List pgsql-performance
Brian Herlihy <btherl@yahoo.com.au> writes:
> My options seem to be
>   - Fudge the analysis results so that the selectivity estimate changes.  I
> have tested reducing n_distinct, but this doesn't seem to help.
>   - Combine the columns into one column, allowing postgres to calculate the
> combined selectivity.
>   - Drop the (p2, p3) index.  But I need this for other queries.

Have you considered reordering the pkey to be (p2,p3,p1) and then
dropping the (p2,p3) index?

            regards, tom lane

pgsql-performance by date:

Previous
From: Brian Herlihy
Date:
Subject: Re: Query planner is using wrong index.
Next
From: Brian Herlihy
Date:
Subject: Re: Query planner is using wrong index.