三个层面:
1.系统层面
2.mysql配置参数
3.sql语句优化
===========================================================
一。系统层面
===========================================================
二。mysql参数层面
http://www.oicto.com/mysql-explain-show/
2.1slowlog
配置slowlog 配置文件: log-slow-queries=/path/to/save/slowlog long_time_query=2 变量设置: show variables like '%slow%' set global log_slow_queries = ON set global slow_launch_time = 5 分析slowlog 使用mysqldumpslow工具 mysqldumpslow /path/to/slowfile mysqldumpslow -s t/c/l/r -r -t n file -s sort by c(count),t(query time),l(lock time),r(rows sent, the result) -r reverse -t top n queries