MySQL慢查询统计

按天统计:
grep  Time: mysqlmaster-slow.log | awk '{print $3}'|awk '{a[$1]++}END{for (j in a) print j,": " a[j]}' | sort -nrk2 -t: 

按分钟统计:
grep  Time: mysqlmaster-slow.log | awk '{print $3,$4}'|awk -F : '{print $1,$2}' | awk -F : '{a[$1]++}END{for (j in a) print j,": " a[j]}' | sort -nrk2 -t:

按小时统计:
grep  Time: mysqlmaster-slow.log | awk '{print $3,$4}'|awk -F : '{print $1}' | awk -F : '{a[$1]++}END{for (j in a) print j,": " a[j]}' | sort -nrk2 -t:

你可能感兴趣的:(MySQL慢查询统计)