On Jul 12, 10:55 am, Eliot Horowitz <
eliothorow...@gmail.com> wrote:
> nscanned is actually higher in the 2nd, so the time difference was
> probably transient.
No, the 1st one is also 2 times than the 2nd
>
> Can you try an index on { "_id" : 1 , "task.status" : 1 ,
> "task.actionTime" : 1 }
Well , it is soooo fast.
but the query still use {_id:1} by default.
{
"cursor" : "BtreeCursor _id_",
"nscanned" : 55178,
"nscannedObjects" : 55178,
"n" : 200,
"millis" : 168079,
"nYields" : 842,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
"_id" : [
[
ObjectId("4dfab509b153ba547b94d417"),
ObjectId("ffffffffffffffffffffffff")
]
]
}
}
{
"cursor" : "BtreeCursor
_id_1_task.status_1_task.actionTime_1",
"nscanned" : 62727,
"nscannedObjects" : 269,
"n" : 200,
"millis" : 158,
"nYields" : 1,
"nChunkSkips" : 0,
"isMultiKey" : true,
"indexOnly" : false,
"indexBounds" : {
"_id" : [
[
ObjectId("4dfab509b153ba547b94d417"),
ObjectId("ffffffffffffffffffffffff")
]
],
"task.status" : [
[
0,
0
]
],
"task.actionTime" : [
[
ISODate("2011-07-11T04:00:00.016Z"),
ISODate("2011-07-12T04:00:00.016Z")
]
]
}
}
It could be better if the explain could tell me the "nscanned" is
number of documents or index entries