From: | Richard Neill <rn214(at)richardneill(dot)org> |
---|---|
To: | |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Why does the query planner use two full indexes, when a dedicated partial index exists? |
Date: | 2012-12-20 05:51:57 |
Message-ID: | 50D2A77D.10809@richardneill.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Dear Tom,
Thanks very much for your advice.
>> A psql session is below. This shows that, if I force the planner to use
>> the partial index, by dropping the others, then it's fast. But as soon
>> as I put the full indexes back (which I need for other queries), the
>> query planner chooses them instead, and is slow.
>
> [ experiments with a similar test case ... ] I think the reason why the
> planner is overestimating the cost of using the partial index is that
> 9.1 and earlier fail to account for the partial-index predicate when
> estimating the number of index rows that will be visited. Because the
> partial-index predicate is so highly selective in this case, that
> results in a significant overestimate of how much of the index will be
> traversed.
I think that seems likely to me.
I'll try out 9.2 and see if it helps. As it's a production server, I
have to wait for some downtime, probably Friday night before I can find
out - will report back.
Best wishes,
Richard
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Neill | 2012-12-20 05:57:14 | Re: Why does the query planner use two full indexes, when a dedicated partial index exists? |
Previous Message | Jeff Janes | 2012-12-20 05:12:14 | Re: Why does the query planner use two full indexes, when a dedicated partial index exists? |