diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-03-22 00:34:31 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-03-22 00:34:31 -0400 |
commit | 8df08c84894001d3d3f5d10b3290a1063a453316 (patch) | |
tree | 138335fc92bf63822f93fd68203b1c97fa4db3c6 /src/backend/optimizer/plan/planmain.c | |
parent | 6d8096e2f3f2c1296fa880f44f3fa5701b2f40c4 (diff) | |
download | postgresql-8df08c84894001d3d3f5d10b3290a1063a453316.tar.gz postgresql-8df08c84894001d3d3f5d10b3290a1063a453316.zip |
Reimplement planner's handling of MIN/MAX aggregate optimization (again).
Instead of playing cute games with pathkeys, just build a direct
representation of the intended sub-select, and feed it through
query_planner to get a Path for the index access. This is a bit slower
than 9.1's previous method, since we'll duplicate most of the overhead of
query_planner; but since the whole optimization only applies to rather
simple single-table queries, that probably won't be much of a problem in
practice. The advantage is that we get to do the right thing when there's
a partial index that needs the implicit IS NOT NULL clause to be usable.
Also, although this makes planagg.c be a bit more closely tied to the
ordering of operations in grouping_planner, we can get rid of some coupling
to lower-level parts of the planner. Per complaint from Marti Raudsepp.
Diffstat (limited to 'src/backend/optimizer/plan/planmain.c')
-rw-r--r-- | src/backend/optimizer/plan/planmain.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index d0e872b6466..3dc23662e71 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -440,18 +440,9 @@ query_planner(PlannerInfo *root, List *tlist, static void canonicalize_all_pathkeys(PlannerInfo *root) { - ListCell *lc; - root->query_pathkeys = canonicalize_pathkeys(root, root->query_pathkeys); root->group_pathkeys = canonicalize_pathkeys(root, root->group_pathkeys); root->window_pathkeys = canonicalize_pathkeys(root, root->window_pathkeys); root->distinct_pathkeys = canonicalize_pathkeys(root, root->distinct_pathkeys); root->sort_pathkeys = canonicalize_pathkeys(root, root->sort_pathkeys); - - foreach(lc, root->minmax_aggs) - { - MinMaxAggInfo *mminfo = (MinMaxAggInfo *) lfirst(lc); - - mminfo->pathkeys = canonicalize_pathkeys(root, mminfo->pathkeys); - } } |