Re: Why does the query planner use two full indexes, when a dedicated partial index exists?

Поиск
Список
Период
Сортировка
От Richard Neill
Тема Re: Why does the query planner use two full indexes, when a dedicated partial index exists?
Дата
Msg-id 50D2A77D.10809@richardneill.org
обсуждение исходный текст
Ответ на Re: Why does the query planner use two full indexes, when a dedicated partial index exists?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: Why does the query planner use two full indexes, when a dedicated partial index exists?
Следующее
От: Richard Neill
Дата:
Сообщение: Re: Why does the query planner use two full indexes, when a dedicated partial index exists?