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: Remove redundant compilations of subquery models when processing MainFromClause, AdditionalFromClause and Join/GroupJoin clauses #7647

Closed
maumar opened this issue Feb 17, 2017 · 3 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@maumar
Copy link
Contributor

maumar commented Feb 17, 2017

When processing MainFromClause, AdditionalFromClause, JoinClause inner sequence and GroupJoin inner sequence, we first compile the expression and then check if its a subquery (and if so, compile again).

We should revert the order, first try to compile as subquery, and only if that fails compile the second time. This will simplify the query compilation as well as fix some more instances of issue described in #7476

@tuespetre
Copy link
Contributor

I have addressed this with changes in #7543. It's part of the whole 'impossible to split further' thing.

@maumar
Copy link
Contributor Author

maumar commented Feb 17, 2017

This would be a great candidate to break off that big PR - it should be just few lines of code (call LiftSubquery before CompileMainFromClauseExpression/CompileAdditionalFromClauseExpression/CompileJoinClauseInnerSequenceExpression/CompileGroupJoinInnerSequenceExpression with some extra checks) and it provides decent value on its own.

maumar added a commit that referenced this issue Feb 18, 2017
…ery models when processing MainFromClause, AdditionalFromClause and Join/GroupJoin clauses

This is small optimization for some queries containing subqueries. Before we used to compile them twice, throwing away the first one. This makes it harder to debug code, but also prevents translating GroupJoin queries inside subqueries.

Fix is to reverse the order in which we process those subqueries, this way we only process the subquery twice if the first pass fails (i.e. we can't translate it fully), rather than always.
@maumar
Copy link
Contributor Author

maumar commented Feb 18, 2017

fixed in 49112ba

@maumar maumar closed this as completed Feb 18, 2017
@maumar maumar self-assigned this Feb 18, 2017
@maumar maumar added this to the 2.0.0 milestone Feb 18, 2017
@maumar maumar added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Feb 18, 2017
rpawlaszek pushed a commit to rpawlaszek/EntityFramework that referenced this issue Feb 19, 2017
… subquery models when processing MainFromClause, AdditionalFromClause and Join/GroupJoin clauses

This is small optimization for some queries containing subqueries. Before we used to compile them twice, throwing away the first one. This makes it harder to debug code, but also prevents translating GroupJoin queries inside subqueries.

Fix is to reverse the order in which we process those subqueries, this way we only process the subquery twice if the first pass fails (i.e. we can't translate it fully), rather than always.
@ajcvickers ajcvickers changed the title Query/Cleanup : remove redundant compilations of subquery models when processing MainFromClause, AdditionalFromClause and Join/GroupJoin clauses Query: Remove redundant compilations of subquery models when processing MainFromClause, AdditionalFromClause and Join/GroupJoin clauses May 9, 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-enhancement
Projects
None yet
Development

No branches or pull requests

4 participants