show profiles 查看sql语句执行状态

目录

一、show profiles作用

二、具体用法

1、查看profile是否开启

2、开启profiling

3、查看所有语句的执行步骤

4、具体查看某条语句执行步骤

5、查看单个sql语句的cpu、IO情况

6、查看具体 show profile可以查看哪些信息


一、show profiles作用

是为了查看具体的语句执行状态,在mysql 5.5 以后加了一个profile设置,可以观察到具体语句的执行步骤.

二、具体用法

1、查看profile是否开启

> show  variables like 'profiling';
 +---------------+-------+
| Variable_name | Value |
+---------------+-------+
| profiling     | OFF   |
+---------------+-------+

2、开启profiling

> set profiling=on;
 +---------------+-------+
| Variable_name | Value |
+---------------+-------+
| profiling     | On      |
+---------------+-------+

3、查看所有语句的执行步骤

mysql> show profiles;		
#查看所有语句的执行步骤,当前客户端的profiles,不是全局的profiles,因为变量profiling是用户变量

4、具体查看某条语句执行步骤

mysql> show profile for query 1;	
#查看具体语句的执行步骤

5、查看单个sql语句的cpu、IO情况

 

mysql> show profile block io,cpu for query 2;

 

6、查看具体 show profile可以查看哪些信息

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值