Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt: Synthesize equality conditions during AssociateJoin rule #38716

Closed
andy-kimball opened this issue Jul 6, 2019 · 2 comments · Fixed by #41250
Closed

opt: Synthesize equality conditions during AssociateJoin rule #38716

andy-kimball opened this issue Jul 6, 2019 · 2 comments · Fixed by #41250
Assignees
Labels
C-performance Perf of queries or internals. Solution not expected to change functional behavior.

Comments

@andy-kimball
Copy link
Contributor

When 3 or more tables are joined, it is not uncommon for 3 or more columns to be equivalent. For example:

SELECT * FROM a, b, c WHERE a.x=b.y AND b.y=c.z

The optimizer will consider these join orders:

1. (a join b) join c
2. a join (b join c)

But it will not consider (a join c) join b, because there is no explicit join condition between a and c. This could cause it to miss the best plan (in fact, it does miss the best plan for TPC-H Q9 for this reason).

The optimizer knows that columns (x, y, z) are all equivalent to one another. It can synthesize any missing equality conditions during the AssociateJoin rule, thus opening up new ordering possibilities.

For TPC-H Q9, adding the missing equality condition reduces execution time from ~120s to ~20s.

@andy-kimball andy-kimball added the C-performance Perf of queries or internals. Solution not expected to change functional behavior. label Jul 6, 2019
@justinj
Copy link
Contributor

justinj commented Jul 8, 2019

I think this is a dup of #36226 that Radu found, I've been meaning to look into it but haven't yet.

@rytaft rytaft assigned rytaft and unassigned justinj and RaduBerinde Sep 25, 2019
@rytaft
Copy link
Collaborator

rytaft commented Sep 25, 2019

I'm working on this now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-performance Perf of queries or internals. Solution not expected to change functional behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants