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

Investigate avoiding an extra document fetch on bounded collection scans

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • RSS Sydney

      Cluster key lookups fetch an extra document, compared to index scans which only (walk the key and) only fetch the documents that match the predicate. The example below respectively fetches 2 documents to return 1 on a bounded collscan for a clustered collection, and walks 1 key to fetch 1 document and return 1 document on an index scan for a non-clustered collection.

      // Clustered collection
      {"command":{"find":"c","filter":{"_id":"a"}},"planSummary":"COLLSCAN",
          "keysExamined":0,"docsExamined":2,"nreturned":1}
      // Non-clustered collection
      {"command":{"find":"c","filter":{"_id":"a"}},"planSummary":"IXSCAN { _id: 1 }",
          "keysExamined":1,"docsExamined":1,"nreturned":1}
      

      While clustered collection queries generally outperform non-clustered collection queries as they avoid the index lookup, we should explore avoiding the extra document fetch as an additional performance improvement.

            Assignee:
            Unassigned Unassigned
            Reporter:
            josef.ahmad@mongodb.com Josef Ahmad
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated: