When scanning an index we will check a key to confirm if we have hit the end. If we have hit the end, we will stop the scan but not include that final index entry scanned within the keysExamined counter.
Leaving the index scan
Incrementing the keysExamined counter
Simple reproducer:
for(i=0;i<111;i++){db.t2.insert({x:i})} db.t2.ensureIndex({x:1}) db.t2.find({x:{$in:[3,50,74,100]}}).explain(true)
.... "keysExamined" : 7,
This would scan the keys at the x values of 3, 4, 50, 51, 74, 75, 100 and 101. A total of 8 keys, while the counter remains at 7
- depends on
-
SERVER-17635 Improve SortedDataInterface::Cursor API
- Closed