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: Stop producing N+1 queries for cases where single element subquery is projected inside a DTO #7882

Closed
maumar opened this issue Mar 15, 2017 · 1 comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Mar 15, 2017

As a consequence of fixing issue #7714 we are now producing N+1 queries for cases like:

customers.Select(c => new DTO { Count = c.Orders.Count() })

This is not necessary, because, even though parent query model needs client projection (because DTO is being used), the subquery returns a single result. We need to pass additional information to SqlTranslatingExpressionVisitor, so that it knows that the subquery that its currently processing returns a single result and that i can actually be fully translated into the parent query (unless something else forces client evaluation)

@maumar
Copy link
Contributor Author

maumar commented Mar 15, 2017

This is already fixed in dev branch - we are binding to parent query directly and never attempt to introduce the _outer parameters, closing

@maumar maumar closed this as completed Mar 15, 2017
@divega divega added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug labels May 8, 2017
@divega divega added this to the 2.0.0-preview1 milestone May 8, 2017
@ajcvickers ajcvickers changed the title Query : stop producing N+1 queries for cases where single element subquery is projected inside a DTO Query: Stop producing N+1 queries for cases where single element subquery is projected inside a DTO May 9, 2017
@divega divega added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. labels May 10, 2017
@ajcvickers ajcvickers modified the milestones: 2.0.0-preview1, 2.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

3 participants