forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: split disjunction in join conditions in more cases
Prior to this commit, when a join condition included a disjunction (e.g. a OR b), in some cases we could remove the disjunction by splitting the join into a UNION of joins to create a more efficient plan. However, we were only performing this transformation if at least one side of the OR predicate contained an equijoin predicate (e.g., t1.col1 = t2.col1). There were other cases where we could have improved the plan by splitting the disjunction, but we did not do so. This commit improves our ability to optimize joins with disjunctions in the join condition when there is the possibility to push one or both sides of the disjunction below the join. This commit adds logic to detect these cases and splits the disjunction to make predicate push-down possible. Fixes cockroachdb#97695 Release note (performance improvement): the optimizer now creates a better query plan in some cases where an inner, semi, or anti join contains a join predicate with a disjuction (OR condition). In cases where one or both sides of the OR condition contains a conjunction with at least one conjunct that references a single table, the optimizer now splits the disjunction so that the conjunct referencing a single table can be pushed below the join.
- Loading branch information
Showing
9 changed files
with
1,771 additions
and
608 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.