How do I profile MySQL?
What tools exist to profile MySQL, like how MSSQL 2000+ does with the SQL Profiler?
I'd want to trace things like SQL statements executed, execution times, execution plan, etc.
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:
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 4:
You can also check out MySQLTuner
Solution 5:
Here is an good article about the profiler of MySQL. Although take a look at the explain statement.