Skip to content

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

Closed

Description

@roji

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.

Activity

  1. CanuckAussieKev commented on Sep 24, 2019

    @CanuckAussieKev

    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?

  2. brunom commented on Sep 26, 2019

    @brunom

    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.

  3. added this to the 3.1.0 milestone on Sep 30, 2019
  4. added a commit that references this issue on Oct 2, 2019
    2e19906
  5. changed the title [-]Discuss cartesian explosion and discuss workarounds[/-] [+]Breaking changes note on new single-query behavior and cartesian explosion[/+] on Oct 2, 2019
  6. added a commit that references this issue on Oct 2, 2019
    e8b9209
  7. added a commit that references this issue on Oct 2, 2019
    2c4b417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions