diff options
| author | Ashutosh Bapat | 2011-06-01 08:54:51 +0000 |
|---|---|---|
| committer | Michael P | 2011-06-06 03:02:41 +0000 |
| commit | 801af8baca96f403e982e0bf36698dc26be26754 (patch) | |
| tree | efaf92df2288ed09a54e6b7f4bf95562ee688688 /src/include | |
| parent | a186a47d75e278909ec1346a2919b9e2cdbe469d (diff) | |
Push GROUP BY clause to the datanode for grouping without aggregation (i.e. when
we choose Group plan for grouping. Group plan requires that the input to this
node be sorted on columns/expression involved in GROUP BY clause. Hence
construct a ORDER BY clause corresponding to GROUP BY clause. Also add the same
information to the RemoteQuery node, so that the sorted data from different
datanodes can be merged at the coordinator so as to feed the sorted output to
the Group node. The number of rows resulting after grouping is lesser or equal
to the qualifying rows from the relations/joins. Hence by pushing GROUP BY to
the datanodes, we reduce (in rare cases keep same) the number of rows fetched
from datanodes, thus saving bandwidth.
The optimization works under following restrictions
1. Group plan has Sort->Result->Material->RemoteQuery nodes under it. Result and
Material nodes are optional.
2. There is no having clause, ORDER BY clause, windowing clause, Distinct clause
in the query.
3. Such grouping uses Sorting for Grouping. (direct implication of
first restriction)
The patch also adds more test to file xc_groupby.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/optimizer/planmain.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h index e595f1e003..28b4ad7569 100644 --- a/src/include/optimizer/planmain.h +++ b/src/include/optimizer/planmain.h @@ -82,7 +82,8 @@ extern ModifyTable *make_modifytable(CmdType operation, List *resultRelations, List *subplans, List *returningLists, List *rowMarks, int epqParam); extern bool is_projection_capable_plan(Plan *plan); -extern Plan *create_remotegrouping_plan(PlannerInfo *root, Plan *agg_plan); +extern Plan *create_remotegroup_plan(PlannerInfo *root, Plan *local_plan); +extern Plan *create_remoteagg_plan(PlannerInfo *root, Plan *agg_plan); /* * prototypes for plan/initsplan.c |
