I get ask, by application developers, “how do you optimize MySQL”. I do lots of things that don’t really relate to a developer. I analyze the percent of queries are being pulled from cache for instance. What a developer can do to optimize the SQL they develop is a different questions. So here is a quick list of things applications developers should know about MySQL.
Explain will analyze your query.
This example shows the possible indexes (keys) that could be used and the index that was selected. 2,262 rows where selected and then sorted (Using file sorts) and one record was returned (limit 1).
mysql> explain SELECT 5/9*(temp_F-32) as t, 5/9*(dewpt_F-32) as td, speed_mps as spd, dir > where stn='KLDM' and date_time<'2010-02-12 18:15' and …[Read more]