You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b8998c7
Browse filesBrowse the repository at this point in the historyBrowse files
perf: Convert inner joins to semi joins when equivalent (#22652)
## Which issue does this PR close?
- Closes#22594
## Rationale for this change
This PR extends the `EliminateJoin` rewrite pass to replace inner joins
with semi joins in some cases. An inner join `L ⋈ R` can be rewritten to
a left semi join `L ⋉ R` if two conditions hold:
1. None of R's columns are referenced above the join
2. (a) each L row matches at most one R row, OR (b) the consumers of the
join result are insensitive to duplicates
(And symmetrically with right semi joins.)
## What changes are included in this PR?
* Add `for_each_referenced_index` helper that is used by both
`EliminateJoin` and `EliminateProjections`
* Introduce `LiveColumns` type to track the "live" (referenced by
parent) columns of a plan node
* Add inner -> semi join rewrite to `EliminateJoin`
* Add unit and SLT tests for rewrite behavior
* Update SLT test fixtures for plan changes
## Are these changes tested?
Yes; new tests added.
## Are there any user-facing changes?
Some plan changes but no behavioral changes.
---------
Co-authored-by: Daniël Heres <[email protected]>
0 commit comments