Mysql – Top 10 in MySQL

MySQL

Following a load test of my website I am trying to find the slowest performing web objects of my application. I have a field called 'path' with the applications object path along with a field called 'total_active' which gives the load time of the object. I have thousands of these records and I was wondering how I could just get the top 10 slowest along which what the objects slowest load time was.

I've tried the following, but it just gives me the objects in order of load time and doesnt group them. Can anyone advise?

select 
    path,
    time_active
from lb.object
order by time_active desc
limit 10;

Best Answer

SELECT path, sum(time_active) as summed FROM lb.object
group by path
order by summed desc limit 10

?