Query performance can either be a constant headache or the unsung hero of any application. A well-tuned database will save you time, resources, and money - not to mention avoiding emergency escalations. Technical Services Engineer and "Query Doctor" Chris Harris and Developer Advocate Karen Huaulmé will demonstrate how to discover and optimize slow running queries. We will then teach you how to use the .explain() method and decipher explain plans to gain insight into your database operations and pick just the right indexes for your workloads. Time Stamps: 0:00 Introductions and how Karen tricked Chris into being the chump for this "Stump the Chump" session 5:48 Preview of Chris' MongoDB .Live talk 7:31 Agenda 9:32 Quick Atlas tier overview 11:00 Proper indexing example - M10 vs M30 comparison and the "Query Targeting" graph 17:39 Things to consider when encountering poor performance 19:36 Tools in Atlas that will help with resolving performance issues 19:36 Real time performance panel 21:01 Pro tip regarding metric timing and the real time performance panel 22:22 Query Profiler 23:09 Performance Advisor 25:22 Why is an operation slow? Consider hardware for analytical workloads 27:56 The life-changing improvements of tuning queries: 99+% improvements from building indexes 30:19 What is an explain plan? Let's turn an inefficient collection scan into an efficient index scan 33:30 Using indexes to satisfy a sort request 36:46 The "Scan and Order" Atlas graph 37:53 The three Atlas charts that you should look at related to query efficiency and workload 39:04 Compound indexes: ESR guidance and why key ordering is important 41:21 The general structure of explain output, winningPlan and rejectedPlans sections 46:27 Question about wildcard indexes 52:04 Interpreting an explain plan for an aggregation 54:59 gowthamraj100 catches Chris being lazy - What does explain(1) mean? 1:01:24 High level information about querying sharded clusters 1:04:37 sergiocasao asks about query predicates and compound index usage. The helpful queryPlanner.parsedQuery field and the importance of the first key in the index definition 1:07:56 Summarizing the effect of the "ESR Rule" 1:11:25 gowthamraj100 asks about MongoDB's plan cache (don't forget about .pretty()) 1:14:10 Is there such a thing as too many indexes? $indexStats is helpful for determining index usage 1:18:06 sergiocasao has a few additional questions regarding index usage and next steps. The Atlas UI itself allows you to perform many tasks related to indexing 1:24:08 The team wraps up with a special guest appearance!