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

Query: IN expression optimization of constant should move to compilation phase #16375

Open
roji opened this issue Jul 1, 2019 · 1 comment
Open

Comments

@roji
Copy link
Member

roji commented Jul 1, 2019

Our InExpressionValuesExpandingExpressionVisitor rewrites the values of InExpression, for parameter and constant values. Constant values rewriting can be moved to the compilation phase - there's no reason to do this again for each query.

This would speed up queries such as .Where(x => new[] { 1, 2, 3 }.Contains(x)).

@roji roji self-assigned this Jul 1, 2019
roji added a commit that referenced this issue Jul 1, 2019
Our InExpressionValuesExpanding visitor can turn an an IN expression
to a constant (i.e. when the values list is empty), which is
unsupported in orderings in SqlServer. Detect this and turn these
expressions to a simple constant expression detectable by the
SQL generator, which will generate (SELECT 1).

Fixes #16375
@ajcvickers ajcvickers added this to the Backlog milestone Jul 1, 2019
@smitpatel smitpatel removed the query label Sep 3, 2019
@smitpatel
Copy link
Contributor

Same goes for FromSql where parameters are constant expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants