Tuesday, 10 September 2013

Why was the explain query output giving me BasicCursor eventhough the collection had indexes on it?

Why was the explain query output giving me BasicCursor eventhough the
collection had indexes on it?

I have a collection named stocks , i created a compound index on it as
shown below
db.stocks.ensureIndex({"symbol":1,"date":1,"type": 1, "isValid":
1,"rootsymbol":1,"price":1},{"unique" : false})
I have set profilinglevel , to find out all the slow queries .
One of the query was below took 38 millis , when did explain on it , this
was the below result
Sorry i have updated my question
db.stocks.find({ query: { symbol: "AAPLE", date: "2014-01-18", type: "O",
isValid: true }, orderby: { price: "1" } }).explain();
{
"cursor" : "BasicCursor",
"nscanned" : 705402,
"nscannedObjects" : 705402,
"n" : 0,
"millis" : 3456,
"indexBounds" : {
}
}
My question is why its showing a BasicCursor even though it had indexes on
it ??

No comments:

Post a Comment