Re: Weird indices

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Weird indices
Дата
Msg-id Pine.BSF.4.21.0102191840260.85555-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re: Weird indices  (Joseph Shraibman <jks@selectacast.net>)
Список pgsql-general
On Mon, 19 Feb 2001, Joseph Shraibman wrote:

> Joseph Shraibman wrote:
> >
>
> > Can't postgres do the index lookup first and find out there are only a
> > few tuples that might match?
> >
>

> o=# select count(*) from usertable where p in(1,33) group by p;
>  count
> -------
>     16
>    502
> (2 rows)
>

> This raises some other questions.  Why can't postgres get the count(*)
> from the index?  Why doesn't it predict the correct number of rows in
> the planner? (25 estimated vs 16 actual).

First question: Mostly the same reason.  Not all of the index entries
are necessarily real active rows that you can see, so you would still
have to hit the heap file to get that data, so I'd guess you're already
hitting the entire heap file.

[Tom answered the second]


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: index used when casting to different type?
Следующее
От: adb
Дата:
Сообщение: Re: index used when casting to different type?