git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: c6764eb) | patch
Teach planner to account for HAVING quals in aggregation plan nodes.
Thu, 2 Nov 2017 15:24:12 +0000 (11:24 -0400)
Thu, 2 Nov 2017 15:24:12 +0000 (11:24 -0400)
commit 7b6c07547190f056b0464098bb5a2247129d7aa2
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
src/backend/optimizer/path/costsize.c diff | blob | blame | history
src/backend/optimizer/prep/prepunion.c diff | blob | blame | history
src/backend/optimizer/util/pathnode.c diff | blob | blame | history
src/include/optimizer/cost.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /