C100DBA · Question #64
If the value of totalKeysExamined is 30000 and the value of totalDocsExamined is 0, which of the following option is correct?
The correct answer is B. The query used an index to fetch the results. When totalKeysExamined is 30000 and totalDocsExamined is 0, the query engine satisfied the request entirely through an index without ever touching the underlying documents - this is called a covered query, making B correct. The index contained all the data needed to return…
Question
If the value of totalKeysExamined is 30000 and the value of totalDocsExamined is 0, which of the following option is correct?
Options
- ANone of the above
- BThe query used an index to fetch the results
- CThe query returned 0 documents
- DThe query returned 30000 documents after scanning the documents
How the community answered
(39 responses)- A3% (1)
- B79% (31)
- C13% (5)
- D5% (2)
Explanation
When totalKeysExamined is 30000 and totalDocsExamined is 0, the query engine satisfied the request entirely through an index without ever touching the underlying documents - this is called a covered query, making B correct. The index contained all the data needed to return results, so no document scans were required.
Why the distractors are wrong:
- C is wrong because
totalDocsExamined: 0tells you how the query executed, not what it returned. A covered query can return many documents using only index data. - D is wrong because 30000 refers to index keys scanned, not documents returned after scanning docs - in fact, zero docs were scanned.
- A is wrong because B is clearly correct.
Memory tip: Think of DocsExamined as "did MongoDB open the filing cabinet drawers?" - if it's 0, the index had everything on the label (the index itself), so MongoDB never needed to open a single drawer.
Topics
Community Discussion
No community discussion yet for this question.