Skip to content

Query: correlated collection optimization doesn't get applied for subqueries with AsQueryable #12195

Closed as not planned

Description

@maumar

Currently we only apply correlated collection optimization of the subquery doesn't have any result operators. We should allow AsQueryable, for cases like this:

var query = ctx.LevelOne.Select(l1 => new 
{ 
    l1.Id, 
    Collection = l1.OneToMany_Optional.AsQueryable().Include(l2 => l2.OneToOne_Required_FK).ToList() 
});

i.e. to apply include on a collection when the source qsre is not projected directly (#12181 has more details)

Activity

  1. added this to the milestone on Jun 1, 2018
  2. removed this from the milestone on Aug 17, 2018
  3. maumar commented on Aug 17, 2018

    @maumar
    ContributorAuthor

    need to decide how we approach Include for those complex scenarios.

  4. ajcvickers commented on Aug 20, 2018

    @ajcvickers
    Contributor

    @smitpatel to link to Include issue.

  5. smitpatel commented on Aug 20, 2018

    @smitpatel
    Contributor

    Based on include path interpretation we can determine if we need this kind of pattern supported. #12737

  6. ajcvickers commented on Aug 28, 2018

    @ajcvickers
    Contributor

    Moving this to 3.0 to consider as part of the overall 3.0 query plan: #12795

  7. added this to the 3.0.0 milestone on Aug 28, 2018
  8. 1 remaining item

  9. smitpatel commented on Jun 26, 2019

    @smitpatel
    Contributor

    @maumar - Given that nav rewrite converts methods to queryable, does it swallow away AsQueryable? If not, should it do it? Is this issue relevant anymore?

  10. removed this from the 3.0.0 milestone on Jun 28, 2019
  11. removed their assignment
    on Jan 12, 2022
  12. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions