-
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.
56103: opt: generate zigzag joins on two partial indexes with the same predicate r=mgartner a=mgartner This commit updates the GenerateZigzagJoins exploration rule so that it can generate a zigzag join on two partial indexes with the same predicate expression. This was not possible previously because the remaining filters of the outer `scanIndexIter.ForEach` loop were passed as filters to the inner `scanIndexIter.ForEachStartingAfter` loop. These filters no longer included the expression necessary for proving implication for the second index, so a zigzag join was not planned. If the same non-reduced, original query filters were passed to both the outer and inner loops, then the remaining filters could include unnecessary expressions when planning a zigzag join over two partial indexes with different predicates. Expressions that should have been removed from the remaining filters while proving implication in the outer loop would remain in the remaining filters of the inner loop and ultimately remain in the query plan. Therefore, the proposed solution in this commit is to allow the user to specify the non-reduced, original query filters as additional filters that can prove implication. If the inner loop `scanIndexIter` cannot prove implication with the remaining filters from the outer loop, it attempts to prove implication with the original filters. Release note (performance improvement): They query optimizer can now plan zigzag joins on two partial indexes with the same predicate, leading to more efficient query plans in some cases. 56262: sql: refactor code shared by diagnostics and EXPLAIN ANALYZE (DEBUG) r=RaduBerinde a=RaduBerinde #### sql: pass recording to WithStatementTrace Pass the recording instead of the span. Release note: None #### sql: refactor code shared by diagnostics and EXPLAIN ANALYZE (DEBUG) There are two paths that result in a bundle being collected and inserted into the diagnostics tables. Each path uses its own code to insert the diagnostics bundle, which leads to unnecessary complication. This change simplifies the stmtdiagnostics code to let the caller do the insertion and streamlines the higher level code. Release note: None Co-authored-by: Marcus Gartner <[email protected]> Co-authored-by: Radu Berinde <[email protected]>
- Loading branch information
Showing
14 changed files
with
289 additions
and
222 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
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.