Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.0.GA
    • Fix Version/s: 3.3.0.CR1
    • Component/s: Linq Provider
    • Labels:
      None
    • Sprint:

      Description

      The Linq provider can only generate "exists" or "in list" statements currently, but no "in" statements. This is a problem because many times a simple "in" subquery performs MUCH better than a correlated "exists" subquery.

      Example:
      var result = (from p in _session.Query<Project>()
      where (from c in _session.Query<Customer>()
      where c.Name == "something"
      select c).Contains(p.Customer)
      select p)
      .ToArray();

      Gets translated to:
      select
      columns
      from
      PROJECTS project0_
      where
      exists (
      select
      customer1_.CUS_ID
      from
      CUSTOMERS customer1_
      where
      customer1_.NAME=:p0
      and customer1_.CUS_ID=project0_.CUS_ID
      );

      But much better would be:
      select
      columns
      from
      PROJECTS project0_
      where
      project0_.CUS_ID in (
      select
      customer1_.CUS_ID
      from
      CUSTOMERS customer1_
      where
      customer1_.NAME=:p0
      );

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                cremor cremor
              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Who's Looking?