Index scans don't include the final "end" check within nscanned/keysExamined

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • 3.1.3
    • Affects Version/s: None
    • Component/s: Querying
    • Fully Compatible
    • ALL
    • Quint Iteration 3
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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

            Assignee:
            David Storch
            Reporter:
            David Hows (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: