Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate to IN + subquery when possible instead of EXISTS #30976

Merged
merged 3 commits into from
Jun 4, 2023

Conversation

roji
Copy link
Member

@roji roji commented May 26, 2023

This builds on top of #30956 (ignore first commit) to translate to IN+subquery where possible (see #30955).

Closes #30955

@roji roji requested a review from maumar May 26, 2023 10:25
// Null out the value for the inferred type mapping as an indication of the conflict. If it turns out that we need the
// inferred mapping later, during the application phase, we'll throw an exception at that point (not all the inferred type
// mappings here will actually be needed, so we don't want to needlessly throw here).
_inferredColumns[(underlyingTable, columnExpression.Name)] = null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the "conflicting inferred type mappings" exception to later in the process, so that we don't throw if we don't actually need the inferred mapping (i.e. it doesn't apply to an untyped inline/parameter collection). This should be safer.

@roji
Copy link
Member Author

roji commented May 28, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@roji
Copy link
Member Author

roji commented May 29, 2023

Given the pretty massive perf impact this has (see #30955 (comment)), converting to a draft to consider using IN in more scenarios instead of rewriting to EXISTS (but this can still be reviewed already).

@roji roji marked this pull request as draft May 29, 2023 23:06
@roji roji marked this pull request as ready for review May 30, 2023 15:15
@roji roji merged commit 4334ae0 into dotnet:main Jun 4, 2023
7 checks passed
@roji roji deleted the ContainsSubquery branch June 4, 2023 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translate Contains to IN with subquery instead of EXISTS where relevant
2 participants