-
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.
119095: opt: speed up execbuilder phase r=mgartner a=mgartner #### opt/bench: add benchmark for execbuilder This commit adds a benchmark that measures only the execbuilder phase of optimization, and includes no other phases. Release note: None #### opt/execbuilder: remove column map from execPlan As the execbuilder traverses a relational expression and recursively builds an `execPlan`, it creates mappings from column IDs to their ordinal position in the expression for each `execPlan` node. These mappings are used when building parent nodes to correctly map column IDs to indexed variables. In most cases the mappings are only used when building a parent, and never again. Prior to this commit, the column mappings were a field of `execPlan`, tying the lifetime of `execPlan` nodes and column mappings together. This commit decouples the lifetimes of both by removing the mapping field from `execPlan` and propagating mappings up as return values of recursive function calls. This will enable future optimizations that can reuse memory allocated for mappings that are no longer needed. Release note: None #### opt/exebuilder: introduce colOrdMap This commit introduces a new struct, `colOrdMap`, which maps column IDs to ordinals. See the comment for `colOrdMap` for more details. This type will be used in execbuilder in future commits to store output column mappings. Release note: None #### opt/execbuilder: use colOrdMap to store output columns Output columns of execution nodes are now stored in `colOrdMap`s instead of `opt.ColMap`s. The `colOrdMapAllocator` struct, which is used to allocate new `colOrdMaps` has been added as a field of `Builder`. It currently is a simple implementation. Future commits will extend it to reuse allocated `colOrdMap`s when possible. Release note: None #### opt/execbuilder: reuse allocated colOrdMaps This commit extends `colOrdOrdMapAllocator` with a `Free` method. Freed maps will be reused in future calls to `Alloc` instead of allocating a new map. The build functions of the major relational expressions have been updated to free maps when they are no longer needed. This reduces the number of maps allocated, especially for complex queries with many execution nodes. Informs #117546 Release note: None #### opt/execbuilder: faster maximum ordinal method for colOrdMap This commit makes `colOrdMap.MaxOrd()` a constant-time operation in most cases. See the newly added comments for more details. Release note: None 119597: opt: add tests showing that index hints don't affect uniqueness checks r=rytaft a=rytaft Informs #98211 Release note: None Co-authored-by: Marcus Gartner <[email protected]> Co-authored-by: Rebecca Taft <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,740 additions
and
821 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
Oops, something went wrong.