[SERVER-56294] Extend group to distinct optimization to compound keys Created: 23/Apr/21  Updated: 06/Dec/22  Resolved: 23/Apr/21

Status: Closed
Project: Core Server
Component/s: Performance
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Ruslan Abdulkhalikov (Inactive) Assignee: Backlog - Query Optimization
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-53626 Minimize index scanning when retrievi... Backlog
Assigned Teams:
Query Optimization
Participants:

 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", ...



 Comments   
Comment by Ruslan Abdulkhalikov (Inactive) [ 23/Apr/21 ]

yeah, it is a duplicate

Comment by Charlie Swanson [ 23/Apr/21 ]

ruslan.abdulkhalikov this looks like a duplicate of SERVER-53626 to me? Would you agree?

Generated at Thu Feb 08 05:38:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.