Speed Up Your Database
summary
Shows how a simple join on a hand-built dataset of 200 users, 100 albums/user, 100 pictures/album = 2 million pictures goes from 38.0s to 2.38s when adding album.id, to 0.12s with picture.album_id, to 0.10s with album.user_id and down to 0.009s with pagination and tighter WHERE clauses. Uses MySQL slow query log, EXPLAIN output to count scanned rows, points out ORMs N+1 queries and SQLAlchemy listeners, recommends foreign key indexes, small unsigned integers, partitioning/sharding and the archive engine for cold data.
AI-written summary · about
chapters (14)
- 0:00Introduction and agenda
- 1:25Identifying slow queries
- 3:31Using slow query logs
- 5:38Understanding query execution with EXPLAIN
- 7:02How indexes improve performance
- 9:11Optimizing joins with indexes
- 10:14Database connection limits
- 10:57Index design best practices
- 11:39Avoiding functions on indexed columns
- 12:21Limiting query results
- 13:04Table partitioning and archiving
- 14:05Splitting databases for load
- 14:45Final optimization checklist
- 15:48Q&A session
