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 :: nested Conditional expressions could be optimized #2881

Closed
maumar opened this issue Aug 19, 2015 · 3 comments
Closed

Query :: nested Conditional expressions could be optimized #2881

maumar opened this issue Aug 19, 2015 · 3 comments

Comments

@maumar
Copy link
Contributor

maumar commented Aug 19, 2015

Currently nested Conditional expressions are not optimized, we translate them to:
CASE WHEN c1 THEN r1 ELSE (CASE WHEN c2 THEN r2 ELSE r3 END) END

We could instead simplify it to:
CASE WHEN c1 THEN r1 WHEN r2 THEN r2 ELSE r3 END

@maumar maumar self-assigned this Aug 19, 2015
@divega
Copy link
Contributor

divega commented Aug 19, 2015

FWIW, SQL Server has a limit of 10 levels of nesting for CASE expressions and this did become an issue with previous versions of EF because we used to generate nested case statements often, so we had to do case flattening as a bug fix rather than as optimization. Not saying that we are anywhere near this with EF Core.

@smitpatel
Copy link
Contributor

Closing as duplicate of #12729

@Yen-David
Copy link

@smitpatel, it's not really a duplicate. It was fixed in .Net Core 2.2 but appeared again in .Net Core 3.0! You must re-close it (close it again).

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
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

6 participants