Allow DISTINCT_SCAN in subplans

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Relevant PR comment.

      We can likely just enable this for the distinct() command directly, since the distinct command always tries to dedup the output of a DISTINCT_SCAN (even if it doesn't actually have to).

      For aggregations, we would also have to disable generating the $groupByDistinct stage (otherwise we may return duplicates for a $group that should only return unique values on its _id/ the DISTINCT_SCAN key), so it is less likely to be useful there.

      In either case, doing this would disable SBE usage for $or queries that are distinct-like (until we implement distinct in SBE), so we would need some performance testing to justify whether or not this truly is beneficial.

            Assignee:
            Unassigned
            Reporter:
            Alya Berciu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: