Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-78468

Single interval query keysExamined information is inaccurate

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 5.0.14
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • Hide

      Create a replica set.

      use mydb;
      
      db.coll.createIndex({a:1});
      
      db.coll.insert({a:1})
      
      db.coll.insert({a:false})
      
      db.coll.insert({a: ""})
      
      db.coll.find({a:{$gte:1}}).explain("allPlansExecution"); //  keysExamined = 1
      
      db.coll.find({a: {$in:[1, 2]} }).explain("allPlansExecution"); //  keysExamined = 2
      

      The above two queries should scan 2 documents:

      {a:1}

      and

      {a: ""}

      But the single interval query will only show keysExamined as 1.

       

      Show
      Create a replica set. use mydb; db.coll.createIndex({a:1}); db.coll.insert({a:1}) db.coll.insert({a:false}) db.coll.insert({a: ""}) db.coll.find({a:{$gte:1}}).explain("allPlansExecution"); //  keysExamined = 1 db.coll.find({a: {$in:[1, 2]} }).explain("allPlansExecution"); //  keysExamined = 2 The above two queries should scan 2 documents: {a:1} and {a: ""} But the single interval query will only show keysExamined as 1.  

      When using a single interval query, the number of scanned keys displayed by explain is inaccurate. 

      If the traversed data no longer meets the requirements , and the returned kv is empty code.

      keysExamined will not increase. code

      But multi-range queries use other methods to check bounds code

      keysExamined data can be counted correctly.

       

       

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            1321280378feng@gmail.com Chao Yin
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: