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.
opt: add transformation rule to convert anti join to left join
Release justification: bug fixes and low-risk updates to new functionality ConvertAntiToLeftJoin converts an anti join to a left join with the same ON condition, wraps the expression in a Select to remove rows that matched the ON condition, and then projects out the left side columns. For example (assuming x is a not-null column in b): SELECT * FROM a WHERE NOT EXISTS ( SELECT * FROM b WHERE ST_Intersects(a.geom, b.geom) ); is converted to: SELECT a.* FROM a LEFT JOIN b ON ST_Intersects(a.geom, b.geom) WHERE b.x IS NULL; Note that this transformation is not desirable in the general case, but it is useful if there is a possibility of creating an inverted join (such as in the above example). For this reason, we only perform this transformation if it is possible to generate an inverted join. This transformation allows us to index-accelerate spatial anti joins, which was not possible before. Informs cockroachdb#53576 Release note (performance improvement): spatial anti joins can now be index-accelerated, which can lead to performance improvements in some cases.
- Loading branch information
Showing
7 changed files
with
445 additions
and
50 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
Oops, something went wrong.