-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
57690: opt: generate lookup joins on partitioned indexes r=mgartner a=mgartner #### xform: add rule expectations for GenerateLookupJoins tests Release note: None #### opt: generate lookup join for column constrained to multiple constants Previously, the optimizer could create lookup join keys from filters that constrain a column to a single constant value. This was done by wrapping the join input in a Project that projected the constant value, and using this new column as a key column. This commit generalizes this behavior so that lookup join keys can also be created from filters that constrain a column to multiple, non-ranging constant values. The constant values are cross-joined with the input, and the joined column is used as a key column. If a column is constrained to a single constant value, the cross join normalizes to a Project identical to the Projects constructed prior to this commit. Release note (performance improvement): The query optimizer can use filters that constrained columns to multiple constant values to generate lookup joins. For example, a join filter `x.a = y.a AND y.b IN (1, 2)` can be used to generate a lookup join on table `y` assuming that it has an index on `(a, b)` or `(b, a)`. #### opt: generate lookup joins with CHECK constraints and computed columns Previously, only explicit filters were used to generated lookup join key columns. Now lookup join keys can be generated from CHECK constraints and computed column expressions. With this commit and the previous commit, lookup joins on partitioned indexes are explored by the optimizer. Release note (performance improvement): The query optimizer now explores plans with lookup joins on partitioned indexes, resulting in more efficient query plans in some cases. #### xform: do not propagate join hints to GenerateLookupJoins cross joins This commit fixes a bug that prevented a `LOOKUP` join hint from producing a plan with a lookup join. Previously, the hint was propagated to the synthesized cross join created as input to the lookup join. This artificially inflated the cost of the cross join, making the lookup join too costly to be selected as the optimal plan. Release note: None Co-authored-by: Marcus Gartner <[email protected]>
- Loading branch information
Showing
15 changed files
with
610 additions
and
263 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
Oops, something went wrong.