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.
97696: opt: split disjunction in join conditions in more cases r=rytaft a=rytaft **sql: add session setting `optimizer_use_improved_split_disjunction_for_joins`** This commit adds a new session setting, `optimizer_use_improved_split_disjunction_for_joins`, which will be used in the next commit. Release note (sql change): added a new session setting, `optimizer_use_improved_split_disjunction_for_joins`, which enables the optimizer to split disjunctions (`OR` expressions) in more cases in join conditions by building a `UNION` of two join expressions. If this setting is true, all disjunctions in inner, semi, and anti joins will be split. If false, only disjunctions potentially containing an equijoin condition will be split. **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 removes the requirement that the disjunction contains an equijoin predicate, and instead splits the disjunction in all cases where it is possible to do so, thus enabling more optimization opportunities. Fixes cockroachdb#97695 Release note (performance improvement): if the session setting `optimizer_use_improved_split_disjunction_for_joins` is true, 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). Co-authored-by: Rebecca Taft <[email protected]>
- Loading branch information
Showing
18 changed files
with
1,879 additions
and
630 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
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
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
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.