Re: 8.3 planner handling of IS NULL in aggregations

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 8.3 planner handling of IS NULL in aggregations
Дата
Msg-id 24014.1215189468@sss.pgh.pa.us
обсуждение исходный текст
Ответ на 8.3 planner handling of IS NULL in aggregations  (Sam Mason <sam@samason.me.uk>)
Ответы Re: 8.3 planner handling of IS NULL in aggregations  (Sam Mason <sam@samason.me.uk>)
Список pgsql-general
Sam Mason <sam@samason.me.uk> writes:
> I've just noticed that the planner in 8.3.3 doesn't seem to realize the
> difference in the result of the following:
>   GROUP BY col;
>   GROUP BY col IS NULL;

Yeah, estimate_num_groups doesn't have any special knowledge about IS
NULL -- it just sees this as "an expression involving col".  The
general assumption about that is that the expression doesn't reduce
the number of groups (think "col + 1" for example).  In general I'd
rather it overestimated the number of groups than underestimated,
so I don't think this heuristic is really wrong.

Putting in a special case for IS NULL seems a bit silly, but maybe
checking for a boolean result type would cover enough real-world
uses to be worth the trouble?  Not sure.

            regards, tom lane

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: [Postgresql 8.2.3] autovacuum starting up even after disabling ?
Следующее
От: Sam Mason
Дата:
Сообщение: Re: 8.3 planner handling of IS NULL in aggregations