博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
分析语句执行步骤并对排出耗时比较多的语句
阅读量:5338 次
发布时间:2019-06-15

本文共 1501 字,大约阅读时间需要 5 分钟。

mysql>set profiling=1;

mysql>show profiles;

mysql> set @query_id=6;
Query OK, 0 rows affected (0.00 sec)

mysql> select state,sum(duration) as total_R,round(100*sum(duration)/(select sum(duration) from information_schema.profiling where query_id=@query_id),2) as Pct_R,count(*) as Calls,sum(DURATION)/count(*) as "R/Call" from information_schema.profiling where query_id=@query_id group by state order by Total_R DESC;

+----------------------+----------+-------+-------+--------------+
| state | total_R | Pct_R | Calls | R/Call |
+----------------------+----------+-------+-------+--------------+
| Sending data | 0.026548 | 44.76 | 1 | 0.0265480000 |
| init | 0.025457 | 42.92 | 1 | 0.0254570000 |
| System lock | 0.005633 | 9.50 | 1 | 0.0056330000 |
| query end | 0.001312 | 2.21 | 1 | 0.0013120000 |
| freeing items | 0.000155 | 0.26 | 1 | 0.0001550000 |
| starting | 0.000076 | 0.13 | 1 | 0.0000760000 |
| Opening tables | 0.000029 | 0.05 | 1 | 0.0000290000 |
| statistics | 0.000019 | 0.03 | 1 | 0.0000190000 |
| cleaning up | 0.000019 | 0.03 | 1 | 0.0000190000 |
| closing tables | 0.000017 | 0.03 | 1 | 0.0000170000 |
| end | 0.000015 | 0.03 | 1 | 0.0000150000 |
| preparing | 0.000012 | 0.02 | 1 | 0.0000120000 |
| optimizing | 0.000011 | 0.02 | 1 | 0.0000110000 |
| checking permissions | 0.000011 | 0.02 | 1 | 0.0000110000 |
| executing | 0.000002 | 0.00 | 1 | 0.0000020000 |
+----------------------+----------+-------+-------+--------------+

转载于:https://www.cnblogs.com/lehao/p/3928832.html

你可能感兴趣的文章
关于谷歌浏览器Chrome正在处理请求的问题解决
查看>>
Git核心技术:在Ubuntu下部署Gitolite服务端
查看>>
平面波展开法总结
查看>>
建造者模式
查看>>
ArraySort--冒泡排序、选择排序、插入排序工具类demo
查看>>
composer 安装laravel
查看>>
8-EasyNetQ之Send & Receive
查看>>
Android反编译教程
查看>>
java重写LinkedList
查看>>
zTree节点重叠或者遮挡
查看>>
List<string> 去重复 并且出现次数最多的排前面
查看>>
js日志管理-log4javascript学习小结
查看>>
Android之布局androidmanifest.xml 资源清单 概述
查看>>
How to Find Research Problems
查看>>
Linux用户管理
查看>>
数据库第1,2,3范式学习
查看>>
《Linux内核设计与实现》第四章学习笔记
查看>>
使用iperf测试网络性能
查看>>
struts2入门之准备工作
查看>>
从C语言的弱类型属性说起
查看>>