Re: sunquery and estimated rows

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: sunquery and estimated rows
Дата
Msg-id 3802.1082159101@sss.pgh.pa.us
обсуждение исходный текст
Ответ на sunquery and estimated rows  (Litao Wu <litaowu@yahoo.com>)
Ответы Re: sunquery and estimated rows  (Markus Bertheau <twanger@bluetwanger.de>)
Список pgsql-performance
Litao Wu <litaowu@yahoo.com> writes:
> When I included a subquery, the estimated rows (1240)
> is way too high as shown in the following example.

> select * from test
> where scope=(select 10);

The planner sees that as "where scope = <some complicated expression>"
and falls back to a default estimate.  It won't simplify a sub-select
to a constant.  (Some people consider that a feature ;-).)

The estimate should still be derived from the statistics for the
scope column, but it will just depend on the number of distinct
values for the column and not on the specific comparison constant.

            regards, tom lane

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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Poor performance of group by query
Следующее
От: Christopher Browne
Дата:
Сообщение: Re: Long running queries degrade performance