GitHub user jianqiao opened a pull request:
https://github.com/apache/incubator-quickstep/pull/177
Reduce the number of group-by attributes by pulling tables up aggregation.
This PR implements an optimization (physical plan transformation) that
pulls a table up an aggregation if many of that table's attributes serve as
group-by attributes in the aggregation. We do the optimization because it is
relatively slow to aggregate with a large set of group-by attributes, as well
as to avoid copying the table's many attributes all the way up a chain of
operators.
For example, let `R` be a relation with `PRIMARY KEY x` and attributes `y`,
`z`. Let `S` be a relation with `FOREIGN KEY u` refering to `R.x` and attribute
`v`. Then the optimization rule will transform the physical plan:
```
Aggregate(
[input relation]: HashJoin(
[probe relation]: S
[build relation]: R
[join expression]: S.u = R.x
[project attributes]: v, x, y, z
)
[aggregate expression]: SUM(v) AS sum_v
[group-by attributes]: x, y, z
)
```
into:
```
HashJoin(
[probe relation]: Aggregate(
[input relation]: S
[aggregate expression]: SUM(v) AS sum_v
[group-by attribute]: u
) AS T
[build relation]: R
[join expression]: T.u = R.x
[project attributes]: sum_v, x, y, z
)
```
This optimization improves the performance of TPC-H Q10 from ~13s to ~5.7s,
with scale factor 100 on a cloudlab machine.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/incubator-quickstep
reduce-group-by-attrs
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-quickstep/pull/177.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #177
----
commit 83d1b592445eb27ad34d56ded14618b019bdd11d
Author: Jianqiao Zhu <[email protected]>
Date: 2017-01-30T00:36:14Z
Reduce the number of group-by attributes by pulling tables up aggregations
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---