Details
-
New Feature
-
Resolution: Duplicate
-
Minor - P4
-
None
-
None
-
None
-
Query Optimization
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
- duplicates
-
SERVER-53626 Minimize index scanning when retrieving distinct values grouped by more than one field
-
- Backlog
-