-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Minor Change
-
ALL
-
Query 2017-06-19
-
(copied to CRM)
Not sure why this is happening, but given index on username:1 match by username and group on username correctly uses covered index, but grouping on constant does not:
aggregate { aggregate: "t1", pipeline: [ { $match: { username: /^a/ } }, { $group: { _id: "$username", count: { $sum: 1.0 } } } ], cursor: {} } planSummary: IXSCAN { username: 1.0 } keysExamined:2 docsExamined:0 cursorExhausted:1 numYields:0 nreturned:1 aggregate { aggregate: "t1", pipeline: [ { $match: { username: /^a/ } }, { $group: { _id: 1.0, count: { $sum: 1.0 } } } ], cursor: {} } planSummary: IXSCAN { username: 1.0 } keysExamined:2 docsExamined:1 cursorExhausted:1 numYields:0 nreturned:1
- is duplicated by
-
SERVER-31122 Count by regex match on index is not a covered query
- Closed
-
SERVER-17266 count command performance optimization should support more complex queries
- Backlog
- is related to
-
SERVER-17148 Remove plans do not need a FETCH stage
- Blocked
- related to
-
SERVER-29300 Consider allowing COUNT_SCAN plans when the $ne operator is present
- Closed