Question 36 / 50
Good to KnowHardConceptIndexing
What is a covered query?
Think about it first.
Short answer
A query answered entirely from an index: every filter and projected field is in that index, so the server never fetches the document. In explain you see IXSCAN without a FETCH.
Why?
You usually have to exclude _id from the projection unless _id is in the index. Covered queries are worth it on hot, skinny reads. Widening an index only to cover a query is a write-cost trade.
Interview tip
Mention IXSCAN without FETCH. That is the explain fingerprint.
Common mistake
Calling any IXSCAN a covered query. IXSCAN plus FETCH still touches documents.
How did you do?
Cheat Sheet