Database Reference
In-Depth Information
"nscannedObjectsAllPlans" : 0,
"nscannedAllPlans" : 2,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
" indexBounds" : {
"ts" : [
[
ISODate("2013-12-01T08:00:00Z"),
ISODate("0NaN-NaN-NaNTNaN:NaN:NaNZ")
]
]
}
}
Unfortunately, MongoDB can really only use a single index in a given
query, so adding the customer_id index cannot help with this query.
To improve performance, a compound index would have to be added:
> db.metrics.ensureIndex({customer_id:1,ts:1});
> db.metrics.find({customer_id:1,ts:{$gt:new
Date(2013,11,01)}})
.explain()
{
" cursor" : "BtreeCursor customer_id_1_ts_1",
"isMultiKey" : false,
"n" : 0,
"nscannedObjects" : 0,
"nscanned" : 0,
"nscannedObjectsAllPlans" : 0,
"nscannedAllPlans" : 0,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 0,
Search WWH ::




Custom Search