The MySQL database server can display a lot of performance
statistics. However, most of them relate to general server
parameters, such as buffer sizes and query cache settings. Of
course, such settings are important to get right, and can make a
huge difference in performance. Once you've tuned them however,
you need to start looking at the tables and queries. When a
single bad query can cost 90 - 99% of the total
performance, server tuning doesn't fix the problem. But obtaining
query profiling information from MySQL can be tricky. Here are
some of the options:Slow query logYou can use the built-in
slow_query_log from within the server. It will show you queries
that take more than a second. Such queries typically don't use
indices properly and are important to address. But only slow
queries end up there, and many performance problems aren't caused
by slow queries, but by queries that are run very often (for
example, for-loops in the code …
[Read more]