Mysql慢日志统计分析

统计某一时间段内,慢SQL执行次数,查询时间,扫描行数等。
实现原理其实就是使用PT工具;
/usr/bin/pt-query-digest --user=root --password=123456 --port=3306 --review h=xx.xx.xx.xx,D=mysql,t=review --history h=xx.xx.xx.xx,D=mysql,t=review_history --no-report --limit=100% --charset=utf8 --since '2024-12-25 08:00:00' --until '2024-12-25 09:00:00' /data/mysql/slow.log
将分析结果保存到review和review_history表,然后查询展现。

浙公网安备 33010602011771号