Mysql查看sql的执行时间

来源:互联网 发布:亚虎网络娱乐网页版 编辑:程序博客网 时间:2024/06/06 12:55

在mysql中我们可以通过以下的方法去了解sql执行的具体步骤以及之间,这可以为

 

1. 查看profiling的状态,1为开启,默认处于关闭状态

SELECT @@profiling;

 

2. 开启
SET profiling = 1;


3. 执行sql语句

 

4. 显示 profiles的信息,格式看着不爽的可以在后面加上\G

show profiles;
show profiles\G;

 

5. 具体查看某一次的就可以通过指定query_id的方式

show profile for query 2;

show profile block io,cpu for query 2;

0 0