Re: LIMIT confuses the planner

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: LIMIT confuses the planner
Дата
Msg-id 18725.1235412110@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: LIMIT confuses the planner  (Kouber Saparev <kouber@saparev.com>)
Ответы Re: LIMIT confuses the planner  (Kouber Saparev <kouber@saparev.com>)
Список pgsql-performance
Kouber Saparev <kouber@saparev.com> writes:
> Now the planner believes there're 910 rows, which is a bit closer to the
> real data:

> swing=# select avg(length) from (select username, count(*) as length
> from login_attempt group by username) as freq;
>           avg
> ----------------------
>   491.6087310427555479
> (1 row)

Hmph, that's still not real good.  Ideally it should be estimating
*less* than the average frequency, because the estimate is made after
excluding all the most-common-values, which evidently 'kouber' is not
one of.  I suppose there's quite a large number of infrequently-seen
usernames and the ndistinct estimate is much less than reality?  (Look
at the pg_stats row for this column.)  It might be worth going all the
way to stats target 1000 for this column.

            regards, tom lane

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

Предыдущее
От: Kouber Saparev
Дата:
Сообщение: Re: LIMIT confuses the planner
Следующее
От: Sergio Lopez
Дата:
Сообщение: Re: Benchmark comparing PostgreSQL, MySQL and Oracle