-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Performance
-
None
-
Query Optimization
> 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", ...
- duplicates
-
SERVER-53626 Minimize index scanning when retrieving distinct values grouped by more than one field
- Backlog