-
Type:
Improvement
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: Diagnostics, Querying
-
Fully Compatible
-
Query 16 (06/24/16)
-
None
-
0
-
None
-
None
-
None
-
None
-
None
-
None
The execution stats output for explain of a query plan containing the COUNT_SCAN execution stage is missing index bounds information. The other index access stages correctly report their associated index bounds.
> db.foo.drop() true > db.foo.ensureIndex({a:1}) { "createdCollectionAutomatically" : true, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } > db.foo.explain('executionStats').find({a:1}) // Index bounds correctly reported. ... "stage" : "IXSCAN", "nReturned" : 0, "executionTimeMillisEstimate" : 0, "works" : 1, "advanced" : 0, "needTime" : 0, "needYield" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "keyPattern" : { "a" : 1 }, "indexName" : "a_1", "isMultiKey" : false, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 1, "direction" : "forward", "indexBounds" : { "a" : [ "[1.0, 1.0]" ] }, ... > db.foo.explain('executionStats').distinct('a') // Index bounds correctly reported. ... "stage" : "DISTINCT_SCAN", "nReturned" : 0, "executionTimeMillisEstimate" : 0, "works" : 1, "advanced" : 0, "needTime" : 0, "needYield" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "keyPattern" : { "a" : 1 }, "indexName" : "a_1", "isMultiKey" : false, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 1, "direction" : "forward", "indexBounds" : { "a" : [ "[MinKey, MaxKey]" ] }, ... > db.foo.explain('executionStats').count({a:1}) // Index bounds not reported. ... "inputStage" : { "stage" : "COUNT_SCAN", "nReturned" : 0, "executionTimeMillisEstimate" : 0, "works" : 1, "advanced" : 0, "needTime" : 0, "needYield" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "keysExamined" : 1, "keyPattern" : { "a" : 1 }, "indexName" : "a_1", "isMultiKey" : false, "isUnique" : false, "isSparse" : false, "isPartial" : false, "indexVersion" : 1 } ...