Designing MySQL Tables That Scale
Good schemas begin with how data is read. Choose sensible keys, add indexes for real queries and measure with EXPLAIN before optimising.
Before you add an index
- Find the slow query in the log
- Run EXPLAIN and read the row estimate
- Add one index, measure again, and keep it only if it helps
Remember that every index also makes writing slower.