Search Postgresql Archives

Re: 8.3 planner handling of IS NULL in aggregations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sam Mason <sam@xxxxxxxxxxxxx> 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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux