Conclusion / Learn

MongoDB Indexes II

In this unit, you learned how to:

  • Identify which fields in the explain() output will indicate a performance issue, i.e. nReturned, totalDocsExamined, totalKeysExamined
  • Set the verbosity level for explain(), i.e. executionStats
  • Run explain() on a query to determine if the query is using an index
  • Read the explain() output run on a query and identify what index a query is using
  • Create an efficient compound index for a given query
  • Create a wildcard index
  • Create a partial index
  • Create a sparse index
  • Create a clustered time series index
  • Use $indexStats to view the indexes with the most operations and unused indexes in a collection
  • Enable profiling and set the profiling level using db.setProfilingLevel()
  • Use Database Profiler (system.profile collection) to identify slow queries

Resources

Use the following resources to learn more about Indexing with MongoDB:

Lesson 1: How Indexes Work

Lesson 2: Index Usage Details via Explain

Lesson 3: Optimized Compound Indexes

Lesson 4: Wildcard Indexes

Lesson 5: Partial Indexes

Lesson 6: Sparse Indexes

Lesson 7: Clustered Indexes

Lesson 8: Time Series Collections

Lesson 9: How to Monitor Indexes