0:50
From a slow query to its index
The grade is collected for you, and it names the index that fixes it.
Recorded on Monghoul 2.0.0-rc.1. No sound.
What happens
A find on a nested address field returns a few dozen rows and is graded a collection scan, with every document in the collection examined to find them; the plan names the index that would fix it, the index is created from the plan itself, and the same query re-runs graded optimal at 100% efficiency.
Chapters
- 0:00 Open orders
- 0:04 A find on a field inside the shipping address
- 0:18 The grade was collected for you
- 0:21 Collection scan: every document read to return thirty
- 0:22 Open the whole plan
- 0:25 And it names the index that would fix it
- 0:30 Build it
- 0:35 Same query, again
- 0:39 Same rows, and the grade has turned
- 0:43 And the plan agrees