Re: a question about row estimation in postgres

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: a question about row estimation in postgres
Дата
Msg-id 4D86643B.5060404@fuzzy.cz
обсуждение исходный текст
Ответ на a question about row estimation in postgres  (Reynold Xin <rxin@cs.berkeley.edu>)
Список pgsql-general
Dne 20.3.2011 08:20, Reynold Xin napsal(a):
> Following the formula outlined
> in http://www.postgresql.org/docs/8.3/static/row-estimation-examples.html
>
> Both gradrate 10 and gradrate 11 would fall in the first bucket.
>
> Shouldn't the row estimation be:
>
> (11 - 8) / (33 - 8) / 10 * 1302 = 15.624
> and
> (10 - 8) / (33 - 8) / 10 * 1302 = 10.416
>
> instead of 11 and 7?
>
> Perhaps I am missing something. I'd appreciate if you can point it out.
> Thanks!

I haven't checked the exact estimation algorithm implementation, but
I've noticed you're using the exact cardinality (1302). The planner does
not have this exact information, it has to work with the value stored in
pg_class.reltuples - what does this query return?

  select reltuples from rankings where relname = 'rankings'


I guess it will be about 900.

Tomas

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

Предыдущее
От: Reynold Xin
Дата:
Сообщение: a question about row estimation in postgres
Следующее
От: Nathan Boley
Дата:
Сообщение: Re: a question about row estimation in postgres