Re: [PATCH] Partial indicies almost working (I think)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Partial indicies almost working (I think)
Дата
Msg-id 27694.994261056@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Partial indicies almost working (I think)  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: [PATCH] Partial indicies almost working (I think)  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> OK, so how to fix this. It seems to me that all that is required is that for
> partial indicies it should try to add a path for a plain index scan over the
> index and let the cost estimator decide if it's cheaper than a sequential
> scan.

Probably a reasonable first cut: if the index predicate fits, then always
generate a path.  This assumes that partial indexes are usually made to
cover relatively small fractions of the table, but I'm willing to
believe that for starters.

> only thing is, will the cost estimator get it right. At least the partial
> index has an accurate count of the number of matching rows.

Why would you think that?

I can pretty much guarantee that the cost estimator will *not* get it
right --- it has no idea about partial indexes.  You'll need to do some
fooling with the index selectivity estimation routines to account for
the effects of the predicate.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Please add to TODO list
Следующее
От: Marc SCHAEFER
Дата:
Сообщение: NOT IN issue