Change the division of labor between grouping_planner and query_planner
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 27 Aug 2005 22:13:44 +0000 (22:13 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 27 Aug 2005 22:13:44 +0000 (22:13 +0000)
commit36cd533692c1d2fdb7eccdf48e606ae4468b46d0
tree919949de806098cea5800534b693ac22cab4373f
parentec4f17118672c34ff3cb917ebbd1a46bc0c16cbd
Change the division of labor between grouping_planner and query_planner
so that the latter estimates the number of groups that grouping will
produce.  This is needed because it is primarily query_planner that
makes the decision between fast-start and fast-finish plans, and in the
original coding it was unable to make more than a crude rule-of-thumb
choice when the query involved grouping.  This revision helps us make
saner choices for queries like SELECT ... GROUP BY ... LIMIT, as in a
recent example from Mark Kirkwood.  Also move the responsibility for
canonicalizing sort_pathkeys and group_pathkeys into query_planner;
this information has to be available anyway to support the first change,
and doing it this way lets us get rid of compare_noncanonical_pathkeys
entirely.
src/backend/nodes/outfuncs.c
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/plan/planner.c
src/include/nodes/relation.h
src/include/optimizer/paths.h
src/include/optimizer/planmain.h