Re: Why does the query planner use two full indexes, when a dedicated partial index exists? - Mailing list pgsql-performance

From Richard Neill
Subject Re: Why does the query planner use two full indexes, when a dedicated partial index exists?
Date
Msg-id 50D2A77D.10809@richardneill.org
Whole thread Raw
In response to Re: Why does the query planner use two full indexes, when a dedicated partial index exists?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-performance by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Why does the query planner use two full indexes, when a dedicated partial index exists?
Next
From: Richard Neill
Date:
Subject: Re: Why does the query planner use two full indexes, when a dedicated partial index exists?