Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

[TRAFODION-2418] Allow group by push-down to a fact table #893

Merged
merged 1 commit into from Jan 3, 2017
Merged

[TRAFODION-2418] Allow group by push-down to a fact table #893

merged 1 commit into from Jan 3, 2017

Conversation

zellerh
Copy link
Contributor

@zellerh zellerh commented Dec 23, 2016

Trafodion has a rule that pushes a groupby down over a join when possible, but it will not push the groupby to the left child of a join - it relies on join commutativity. This might have been ok 20 years ago when this was coded (by me...), but it isn't good for some situations today. Example:

select d.y, count(f.a), sum(f.b)
from big_fact f join small_dim d on f.x=d.y
where d.a = 1
group by d.y

The plan we would like is a hash join with the group by on big_fact as the left child. To do this, we need to remove the heuristic that prevents this form of push-down.

@Traf-Jenkins
Copy link

Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/1493/

@Traf-Jenkins
Copy link

Copy link
Contributor

@moscowgentalman moscowgentalman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
Looks good to me.

Copy link
Contributor

@DaveBirdsall DaveBirdsall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Looks good to me. Do you know what heuristic is preventing push down via the commutativity rule?

@asfgit asfgit merged commit 7894cc8 into apache:master Jan 3, 2017
@zellerh
Copy link
Contributor Author

zellerh commented Jan 3, 2017

No, I did not investigate in detail why we don't get the transformation with the current rules. It could be the multi-join rule or some other heuristic. To get the plan I wanted it would have had to apply the commutativity rule twice, once to enable the groupby pushdown and a second time to bring the fact table back to the left side.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants