-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Left join push down optimization #15881
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
Conversation
Signed-off-by: damon <wangmengdamon@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! It looks really good. If you want to make it even faster you can try to replace the RHS with a 1 row scan of NULL values and turn the join into a cross product.
Currently a Nested block join is still planned, in certain cases this is even slower than an inner join with matches.
If you plan a cross join with a 1 row table of NULLS, then the performance should be even faster than any hash join. In addition, the relations are more freely moved around for join order optimization as well.
Thank you, that's a really great suggestion! I'll fix it as you recommended. |
@Tmonster, I plan to use the |
I think you are on the right path. You have two options I think here.
I think 2 might be easier since the column binding replacer process can get confusing, although 1 is faster execution wise since it is only 1 logicalDummy scan instead of multiple extra cross products. Let me know if this helps 👍 |
@Tmonster, thank you for the great suggestions! They are really useful. I have adopted the second one. I have worked on the first one and it was almost done, but when I applied the ColumnBindingReplacer to the root plan, it failed on null pointer because the processing operator of the plan was moved into the Rewrite function call and meanwhile new FilterPushdowns can be generated with child operator moved in during the process. ColumnBindingReplacer can't process the incomplete plan and it will be a little complicated to work that around so I chosen the second suggestion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for getting back so late. Had to catch up on some other things. Looks good to me! I can understand that the ColumnBindingReplacer might be difficult to deal with a changing plan due to the optimizer. Can you just let me know why there is not a cross product between all of the RHS tables?
Code has updated as comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
Thanks! |
Left join push down optimization (duckdb/duckdb#15881)
Left join push down optimization (duckdb/duckdb#15881)
Left join push down optimization (duckdb/duckdb#15881)
Left join push down optimization (duckdb/duckdb#15881)
Left join push down optimization (duckdb/duckdb#15881)
Left join push down optimization (duckdb/duckdb#15881)
This PR fixes #15316.