I cannot get the exact difference between "nscanned" and "nscannedObjects" in the Mongodb's explain query output.
On MongoDB Explain documentation I can read:
nscanned Number of items (documents or index entries) examined. Items
might be objects or index keys. If a "covered index" is involved,
nscanned may be higher than nscannedObjects.
nscannedObjects Number of documents scanned.
What's the different between these two fields?
And more specific what does exactly mean when I have a query, which uses a BtreeCursor (an index), and these two fields have two different values, for example:
{
"cursor" : "BtreeCursor a_1_b_1",
"isMultiKey" : false,
"n" : 5,
"nscannedObjects" : 5,
"nscanned" : 9,
(...)
}
I know what a "covered index" is.
I would like to understand exactly what the query did in the example above.
Did it pass through ("scanned") 9 elements (nscanned = 9), where all of them are index entries and read ("examined") the value of only 5 of them (nscannedObjects = 5) to produce the result set?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…