-
Type: Improvement
-
Resolution: Unresolved
-
Priority: 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.
- is duplicated by
-
SERVER-67786 CollectionScan stage triggers redundant cursor next() call when minRecord==maxRecord
- Closed
- related to
-
SERVER-86519 Use new RecordStore seek API for non-oplog collection scans
- Closed
-
SERVER-85465 RecordStore bounded seek API to replace seekNear
- Closed