Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
58679: opt: use anti-join for INSERT ON CONFLICT DO NOTHING conflict detection r=rytaft a=mgartner #### opt: use anti-join for INSERT ON CONFLICT DO NOTHING conflict detection The addition of lookup anti-joins enables the usage of anti-joins, instead of left joins and filters, for detecting conflicts in an `INSERT ... ON CONFLICT ... DO NOTHING` statement. This simplifies the query plans for these statements. As a result of this change two normalization rules had to be updated: 1. `EliminateGroupByProject` no longer matches `UpsertDistinctOn` expressions because they no longer are built with a `Project` as a child. 2. The `AreValuesDistinct` helper function for `EliminateDistinctOnValues` now detects when the left child of an AntiJoin has distinct values. This is required for eliminating `UpsertDistinctOn` unnecessary operators now that their inputs are AntiJoins. Release note (performance improvement): INSERT ... ON CONFLICT ... DO NOTHING statements now use anti-joins for detecting conflicts. This simplifies the query plan for these statements, which may result in more efficient execution. #### opt: replace &memo.JoinPrivate{} with memo.EmptyJoinPrivate Release note: None Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
- Loading branch information
Showing
12 changed files
with
699 additions
and
1,064 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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.