10 Tips for Optimizing MySQL Queries

In my quest to understand MySQL’s EXPLAIN statement and to learn more strategies for optimizing queries, I came across this excellent blog post from 20bits by Jesse Farmer:

http://20bits.com/articles/10-tips-for-optimizing-mysql-queries-that-dont-suck/

In summary:

  1. Benchmark, benchmark, benchmark!
  2. Profile, profile, profile!
  3. Tighten Up Your Schema
  4. Partition Your Tables
  5. Don’t Overuse Artificial Primary Keys
  6. Learn Your Indices
  7. SQL is Not C
  8. Understand your engines
  9. MySQL specific shortcuts
  10. Read Peter Zaitsev’s MySQL Performance Blog
Written on May 4, 2009