postgresql/src
Tom Lane 7b6c075471 Teach planner to account for HAVING quals in aggregation plan nodes.
For some reason, we have never accounted for either the evaluation cost
or the selectivity of filter conditions attached to Agg and Group nodes
(which, in practice, are always conditions from a HAVING clause).

Applying our regular selectivity logic to post-grouping conditions is a
bit bogus, but it's surely better than taking the selectivity as 1.0.
Perhaps someday the extended-statistics mechanism can be taught to provide
statistics that would help us in getting non-default estimates here.

Per a gripe from Benjamin Coutu.  This is surely a bug fix, but I'm
hesitant to back-patch because of the prospect of destabilizing existing
plan choices.  Given that it took us this long to notice the bug, it's
probably not hurting too many people in the field.

Discussion: https://postgr.es/m/20968.1509486337@sss.pgh.pa.us
2017-11-02 11:24:12 -04:00
..
backend Teach planner to account for HAVING quals in aggregation plan nodes. 2017-11-02 11:24:12 -04:00
bin In client support of v10 features, use standard schema handling. 2017-11-01 19:16:14 -07:00
common Rewrite strnlen replacement implementation from 8a241792f9. 2017-10-10 14:50:30 -07:00
fe_utils Exclude flex-generated code from coverage testing 2017-10-16 16:28:11 -04:00
include Teach planner to account for HAVING quals in aggregation plan nodes. 2017-11-02 11:24:12 -04:00
interfaces Make sure ecpglib does accepts digits behind decimal point even for integers in 2017-11-01 13:32:18 +01:00
makefiles
pl Support domains over composite types in PL/Perl. 2017-10-28 14:02:21 -04:00
port Rewrite strnlen replacement implementation from 8a241792f9. 2017-10-10 14:50:30 -07:00
template Force "restrict" not to be used when compiling with xlc. 2017-10-13 12:15:06 -07:00
test Revert bogus fixes of HOT-freezing bug 2017-11-02 15:51:41 +01:00
timezone Update time zone data files to tzdata release 2017c. 2017-10-23 18:15:36 -04:00
tools Improve gendef.pl diagnostic on failure to open sym file 2017-10-26 10:01:02 -04:00
tutorial Distinguish selectivity of < from <= and > from >=. 2017-09-13 11:12:39 -04:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Reinstate genhtml --prefix option for non-vpath builds 2017-10-14 11:44:45 -04:00
Makefile.shlib
nls-global.mk