Are there any open source MySQL performance tools to help optimize SQL queries?
To profile a mysql command you could use
and to get more information about what mysql would do in order to get your desired result, you could use
Good starting points for optimizations are the usage of indices and the increase of memory usage in
In any case you should use the output of SHOW PROFILE to determine which parts need a lot of time and are worth to be optimized.
Be aware to switch of the query cache while optimizing. You would trick yourself otherwise.