How do I profile MySQL?

Solution 1:

Look into enabling the Query Log and the Slow Query Log.

Solution 2:

if you have query logging turned on on your production/test environment [ which is not necessary the case ] you can use mk-query-digest from maatkit toolkit. it'll help you to determine which queries are most frequent/longest taking etc.


Solution 3:

You can also check out MySQLTuner


Solution 4:

Another commercial option is MySQL Query Analyzer which is part of the MySQL Enterprise Monitor. I've found it to be moderately useful in helping to profile oddball queries to figure out ways to improve their performance.


Solution 5:

Here is an good article about the profiler of MySQL. Although take a look at the explain statement.