Ian Gilfillan’s article on using indexes in MySQL has a good explanation of how to use the EXPLAIN statement to analyze a query, and what to look out for. You can also check out Jesse Farmer’s optimization tips for a primer on more advanced techniques.