MongoDB & NoSQL (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
Query Performance Tuning: `explain("executionStats")`.
senior LevelFormsPerformance
In Simple Words:
COLLSCAN: Full collection scan (reading all documents). Immediate red flag indicating a missing index!IXSCAN: Index scan; only matching index keys are read.totalDocsExaminedvsnReturned: In an optimal query, the ratio is $1:1$. IftotalDocsExaminedis 100,000 andnReturnedis 10, the index is poorly suited for the query.