use mysql; select * from (select * from slow_log where start_time >= '2016-08-01 00:00:01' order by query_time desc) a limit 10;
mysql -u root -p -e "source t_slow.sql" > t_slow.txt
按锁定时间使用倒序的方式排序找出 TOP 10 的慢查询SQL l_slow.sql
use mysql; select * from (select * from slow_log where start_time >= '2016-08-01 00:00:01' order by lock_time desc) a limit 10;
按执行次数使用倒序的方式排序找出 TOP 10 的慢查询SQL c_slow.sql
use mysql; select * from (select sum(query_time),avg(query_time),sum(lock_time),avg(lock_time), sum(rows_sent),avg(rows_sent),sum(rows_examined),avg(rows_examined), count(1),sql_text from slow_log where start_time >= '2016-08-01 00:00:01' group by sql_text order by count(1) desc) a limit 10;
mysql -u root -p -e "source c_slow.sql" > c_slow.txt