When looking at a set of SQL statements in isolation with tools such as the slow query log, processlist and tcpdump/mk-query-digest it is easy to identify queries that are slow.
It is more difficult however to identify the frequency of the query, and whether the slow query is actually acceptable in your overall system design.
I very simple technique to help you is to comment your queries. For example:
SELECT /* 10m cache */ ...;
When I’m working for a client, this process enables me to realize the purpose of the query more quickly and to help prioritize which queries I need to improve first. This does not …[Read more...]