1、下载安装 percona-toolkit 工具包
http://www.percona.com/downloads/percona-toolkit/LATEST/tarball/
2、运行下面两个工具,结果拷屏
pt-summary
pt-mysql-summary --socket=path_to_mysql_socket_dir/mysql.sock
---mysql> select count(*) as cnt,table_schema,engine from information_schema.tables where table_schema not in('mysql','information_schema','PERFORMANCE_SCHEMA') group by table_schema,engine order by cnt desc;
3、查看MySQL中,都使用了哪些引擎
mysql> select table_schema,table_name,engine,TABLE_ROWS,AVG_ROW_LENGTH,DATA_LENGTH,INDEX_LENGTH from information_schema.tables where table_schema not in('mysql','information_schema','PERFORMANCE_SCHEMA') order by table_schema,TABLE_ROWS desc;
如果mysql版本较低,可在业务数据库下执行show table status;
4、业务高峰期时,在操作系统上执行vmstat -S m 3 100(或者vmstat 3 100)的结果
5、查看线程状态
mysql> show processlist;
6、如果第5步有不少SQL经常能看到,把那些SQL的执行计划也收集下,以及相应表的DDL
mysql> explain select....
mysql> show create table table_name;
mysql> show index from table_name;
7、提供慢日志统计结果
mysqldumpslow slow.log > slow-stat.log
slow.log文件名改成你真正的慢日志文件名