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

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: [PATCH] Partial indicies almost working (I think)
Дата
Msg-id 20010705111539.A10153@svana.org
обсуждение исходный текст
Ответ на Re: [PATCH] Partial indicies almost working (I think)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [PATCH] Partial indicies almost working (I think)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Wed, Jul 04, 2001 at 11:37:36AM -0400, Tom Lane wrote:
> 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.

Done that, see my other email.

> > 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?

Well, index->tuples has the number of tuples in the index. By matching I
meant that matching the predicate on the index.

> 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.

See my other email. All I've done is let the normal estimator estimate the
number of rows based on the whole table and then capped it if it comes out
more than the number of rows in the index.

I think the only real way to do it would be to keep seperate statistics for
the part matching the predicate, since it can be considered to be a separate
table, but that requires a few bigger changes. It gets it pretty right at
the moment.

--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> It would be nice if someone came up with a certification system that
> actually separated those who can barely regurgitate what they crammed over
> the last few weeks from those who command secret ninja networking powers.

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

Предыдущее
От: CD Baby
Дата:
Сообщение: PostgreSQL ports post-installation gives core dump?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PostgreSQL ports post-installation gives core dump?