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

Breaking changes note on new single-query behavior and cartesian explosion #1769

Closed
roji opened this issue Sep 24, 2019 · 2 comments · Fixed by #1803
Closed

Breaking changes note on new single-query behavior and cartesian explosion #1769

roji opened this issue Sep 24, 2019 · 2 comments · Fixed by #1803
Assignees
Milestone

Comments

@roji
Copy link
Member

roji commented Sep 24, 2019

Now that we generate a single SQL query for a LINQ query, users will start running into the cartesian explosion problem when joining multiple tables (e.g. dotnet/efcore#18022). We should add a section in the loading related data page with a code sample.

Add a breaking change note.

@KevinMallinson
Copy link

So the docs will essentially have an example of a query which generates dozens or hundreds of joins, with a proposed alternative style of structuring such a query?

In my case, my project is not very mature so it wouldn't be a problem to convert my one query which does this, but I imagine others who have mature projects would be left with a choice, either don't upgrade, or refactor dozens of queries.

Is it possible for there to be an opt out of single linq query so we can have our cake, and at least partially eat it?

@brunom
Copy link

brunom commented Sep 26, 2019

Why can't you use Nested FOR XML Queries?

db.Blogs
.Include(b => b.Posts)
.Include(b => b.Post2s)

would become

SELECT
    *,
    (select * from Posts where Posts.BlogId = Blogs.BlogId FOR XML AUTO),
    (select * from Post2s where Post2s.BlogId = Blogs.BlogId FOR XML AUTO)
FROM Blogs

Note that this is better than EF6 since you require no sort or memory grant.

@smitpatel smitpatel added this to the 3.1.0 milestone Sep 30, 2019
@roji roji changed the title Discuss cartesian explosion and discuss workarounds Breaking changes note on new single-query behavior and cartesian explosion Oct 2, 2019
roji added a commit that referenced this issue Oct 2, 2019
@roji roji closed this as completed in #1803 Oct 2, 2019
roji added a commit that referenced this issue Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants