Is there any way to see an overview of what kind of queries are spent the most time on every day on MySQL?
3 Answers
Yes, mysql can create a slow query log.  You'll need to start mysqld with the --log-slow-queries flag:
mysqld --log-slow-queries=/path/to/your.log
Then you can parse the log using mysqldumpslow:
mysqldumpslow /path/to/your.log
More info is here (http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html).
- 26,244
 - 11
 - 57
 - 60
 
You can always set up query logging as described here:
http://dev.mysql.com/doc/refman/5.0/en/query-log.html
- 8,040
 - 7
 - 41
 - 52
 
It depends on what you mean by 'most time'. There may be thousands if not hundreds of thousands of queries which take very little time each, but consume 90% of CPU/IO bandwidth. Or there may be a few huge outliers. There are tools for performance monitoring and analysis, such as the built-in PERFORMANCE_SCHEMA, the enterprise tools from the Oracle/MySQL team, and online services like newrelic which can track performance of an entire application stack.
- 1,607
 - 10
 - 17