Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-56294

Extend group to distinct optimization to compound keys

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Performance
    • Labels:
      None

      Description

      > db.coll1.insert({a:1, b:2})
      ...
      > db.coll1.createIndex({a:1, b:1})
      ...
      > db.coll1.explain().aggregate({$group: {_id: ["$a", "$b"]}})
      ... "inputStage" : { "stage" : "COLLSCAN" ...
      

      The aggregation on a single key generates efficient DISTINCT_SCAN:

      > db.coll1.explain().aggregate({$group: {_id: "$a"}})
      ... "inputStage" : { "stage" : "DISTINCT_SCAN", ...
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-query-optimization Backlog - Query Optimization
              Reporter:
              ruslan.abdulkhalikov Ruslan Abdulkhalikov
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: