C100DBA practice question 1 of 25
If the value of totalKeysExamined is 30000 and the value of totalDocsExamined is 0, which of the following option is correct?
Full set: 130 questionsThe executionStats values indicate the query's performance. totalKeysExamined: 30000 confirms that the query planner selected and used an index, scanning 30,000 index entries. totalDocsExamined: 0 means that MongoDB did not need to access the actual documents in the collection to fulfill the query. This scenario describes a "covered query," where all the fields required for both the query filter and the returned projection are present in the index itself. Therefore, the query definitely used an index.
A. Option B is a correct and direct conclusion that can be drawn from the provided query execution statistics.
C. We cannot determine the number of returned documents (nReturned) from the given information; a covered query can return results.
D. The query scanned zero documents (totalDocsExamined: 0), not 30,000. totalKeysExamined is the count of index entries scanned.
- MongoDB Manual, explain() Results, executionStats. The documentation defines totalKeysExamined as the "Number of index entries scanned" and totalDocsExamined as the "Number of documents examined."
- MongoDB Manual, Query Optimization, "Covered Query". This section explains that a covered query is one that can be satisfied entirely using an index, resulting in totalDocsExamined being 0.
- MongoDB University, M201 MongoDB Performance, Chapter 2, "Using Indexes", Video "Covered Queries". This lesson details how covered queries work and how to identify them using the explain plan.
Keep practicing
Take the free C100DBA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other C100DBA practice questions
- Question 2The oplog (operations log) is a special capped collection that keeps a rolling record of …
- Question 3‘$set' sets the value of
- Question 4What does the totalKeysExamined field returned by the explain method indicate?
- Question 5Which mongodb tools allow us to work with our data in a human readable format?
- Question 6Which of the following is incorrect statement about find and findOne operations in MongoD…
- Question 7In a sharded replicas set environment with multiple mongos servers, which of the followin…
