-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Critical - P2
-
None
-
Affects Version/s: 2.2.2
-
Component/s: Querying
-
None
-
Environment:RHEL5
index exists:
{ t:1, lc:1, wpm:1}through the Java library I use the
com.mongodb.DBCollection,find(DBObject ref, DBObject keys)
with keys =
{lc: 1, t:1, wpm:1, _id: 0}and this query is logged as
Wed Jan 23 17:31:09 [conn5342] query jerome5.Unit query: { wpm:
{ $gte: 0.008999999612569809 }, t:
{ $in: [ "Central", "Commission", "Kenya", "CKRC", "East", "Mandera", "Constituency", "Report", "North", "Province", "Rhamu" ] }, lc:
{ $in: [ "por", "est", "pol", "vie", "isl", "nor", "ita", "deu", "ces", "eng", "hun", "sqi", "slk", "hin", "slv", "nld", "tur", "dan", "cat", "fra", "fin", "esl", "sve", "lav" ] }} ntoreturn:0 ntoskip:0 nscanned:210 keyUpdates:0 numYields: 1 locks(micros) r:106836 nreturned:83 reslen:3694 126ms
I then ran an explain on a similar query:
db.Unit.find({ wpm:
{ $gte: 0.008999999612569809 }, t:
{ $in: [ "knocking", "witnesses", "care", "off", "you", "systematically", "and" ] }, lc:
{ $in: [ "ukr", "slk", "cat", "zho", "deu", "fra", "por", "fin", "hin", "ces", "slv", "nld", "kor", "est", "jap", "rus", "ara", "pol", "eng", "vie", "sve", "esl", "hun", "isl", "lav", "ell", "tur", "bel", "nor", "bul", "dan", "sqi", "ita", "mkd" ] }},
{t: 1, lc: 1, wpm: 1, _id: 0}).explain();
{
"cursor" : "BtreeCursor t_1_lc_1_wpm_1 multi",
"isMultiKey" : false,
"n" : 63,
"nscannedObjects" : 63,
"nscanned" : 142,
"nscannedObjectsAllPlans" : 480,
"nscannedAllPlans" : 559,
"scanAndOrder" : false,
"indexOnly" : true,
"nYields" : 6,
"nChunkSkips" : 0,
"millis" : 3566,
I don't understand why nscannedObjects is > 0 especially is indexOnly is true. Since i'm not asking for _id, everthing to return is already in the index, so why are any object scans happening?
- duplicates
-
SERVER-4161 nscannedObjects is not calculated properly for covered index queries
- Closed