相关数据
二、Mysql查看Sql语句的执行时间
1、show profiles;
最开始输入show profiles.此时没有数据
2、show variables;
show varables:查看profiling是否开启,即Value为ON
直接使用show variables命令会将所有变量展示出来,太多了,我们不方便查看
就可以使用模糊查询了,用like将profiling挑选出来
一般没有开启都为off
show variables like 'profiling';
3、set profilling=1
,开启profiling
show variables like 'profiling';
这样我们的Mysql就可以查看Sql语句的执行时间
三、不同查询的执行时间
select * from t_users; select id,username,password,real_name,sex,birth,mobile,head_pic from t_users; select * from t_users where username like 'whj';
三种查询的时间对比
结论:
sql 在使用SELECT语句或者使用其它语句时,直接使用*和把所有的字段弄上去查询,性能有很大差距,所以我们平时写查询最好用字段写上
总结
到此这篇关于Mysql中如何查看Sql语句的执行时间的文章就介绍到这了,更多相关Mysql查看Sql语句执行时间内容请搜索