-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: more accurate join multiplicity with FKs and self-joins
When calculating join multiplicity in the presence of a foreign key, it was previously possible for the incorrect base table to be selected from the right expression, in the case that the right expression contained a self-join. The base table selected was incorrect because it did not contain the equality column from the join filter. This prevented the optimizer from determining that these joins preserve all rows from the left side of the join, which could prevent further optimization of a query. Now, only the right equality columns are passed to `checkForeignKeyCase` which ensures that the correct base table is selected. This is safe because `verifyFiltersAreValidEqualities` has already checked that the right equality columns are unfiltered in the right expression, so the same checks in `checkForeignKeyCase` are redundant. Release note (performance improvement): The optimizer better optimizes queries that include both foreign key joins and self-joins.
- Loading branch information
Showing
3 changed files
with
74 additions
and
26 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