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

Extend group to distinct optimization to compound keys

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Minor - P4
    • Resolution: Duplicate
    • None
    • None
    • Performance
    • 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

              backlog-query-optimization Backlog - Query Optimization
              ruslan.abdulkhalikov@mongodb.com Ruslan Abdulkhalikov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: