MySQL5.0.37版本以上支持了Profiling – 官方手册。此工具可用来查询SQL 会执行多少时间,System lock和Table lock 花多少时间等等,对定位一条语句的I/O消耗和CPU消耗 非常重要。从启动profile之后的所有查询包括错误的语句都会记录。关闭会话或者set profiling=0 就关闭了。# 开启profilingmysql> set profiling=1;mysql> select * from user limit 1;mysql> select count(*) from user group by sexal;# 查看这些语句的profilemysql> show profiles;+--------------+----------------+-------------......
阅读全文