mysql性能分析profile
show profile 分析 SQL
第一步查看mysql是否支持profile
select @@have_profiling
yes为支持
第二步查看profile是否开启
select @@profiling
0代表未开启,1代表已开启
如果查询显示0则需要开启
set @@profiling=1
第三步执行一sql语句
select * from person
第四步执行show profiles查看用时
show profiles
可以看到这条语句的用时
第五步根据上述Query_ID查看某一个线程的具体用时
show profile for query 101
show profile all for query 101 (可查看cpu用时)