System Design
4. Database FundamentalsAnimated
Query Execution Plans
The steps the database will take to run a query.
The idea
The plan shows scans, joins and index use, with cost estimates. EXPLAIN reveals it.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- client
- gateway / proxy
- service
- cache
- data store
- queue / stream
Step one: add indexes and cache.
- step:
- 1/4
- at:
- App servers
1/7
The green dot is a request moving through the system.
Step by step
- 1Run EXPLAIN
- 2Look for full scans
- 3Check estimated against actual rows
- 4Add or fix indexes
Where it is used
Diagnosing slow SQL.
Watch out for
Stale statistics make bad plans.