Determine which queries eat most cumulative time

I'm looking for a way to find the cumulative time taken by database
queries. In other words, I'm trying to find out which queries have the
biggest overall impact on application performance.

I need an approach that works with ActiveRecord 2.1.2 and MySQL 5.1. I
have no qualms hacking into ARec myself, but I'd prefer an existing
solution if one exists.

Michael

I'm looking for a way to find the cumulative time taken by database
queries. In other words, I'm trying to find out which queries have the
biggest overall impact on application performance.

I need an approach that works with ActiveRecord 2.1.2 and MySQL 5.1. I
have no qualms hacking into ARec myself, but I'd prefer an existing
solution if one exists.

If you set the slow query log time to 0 then there are various tools
that will analyze your queries for you eg http://www.maatkit.org/doc/mk-query-digest.html
or http://www.mysqlperformanceblog.com/2006/09/06/slow-query-log-analyzes-tools/
(this will obviously dump a lot of data to your slow query log so you
don't want this running 24/7)

Fred

Thanks. mk-query-digest with full logging is the best option, AFAICT.

Michael