MySQL Query Profiler(性能分析工具)的使用方法
来源:互联网 发布:大数据平台 架构设计 编辑:程序博客网 时间:2024/06/04 17:58
转自:http://blog.csdn.net/zhuizhuziwo/article/details/6896842
MySQL 5.0.37版本加入了 MySQL Query Profiler 数据库性能分析工具。
简单的实例
初始化:
mysql> set profiling=1;
Query OK, 0 rows affected (0.04 sec)
mysql> show profiles;
Empty set (0.00 sec)
查询语句:
mysql> SELECT COUNT(nickname), gender FROM users GROUP BY gender;
+-----------------+--------+
| COUNT(nickname) | gender |
+-----------------+--------+
| 106773 | 0 |
| 106462 | 1 |
+-----------------+--------+
2 rows in set (0.88 sec)
查看分析列表:
mysql> show profiles\G;
+----------+------------+-----------------------------------------------------------+
| Query_ID | Duration | Query |
+----------+------------+-----------------------------------------------------------+
| 1 | 0.88324700 | SELECT COUNT(nickname), gender FROM users GROUP BY gender |
+----------+------------+-----------------------------------------------------------+
1 row in set (0.03 sec)
查看sql语句分析1:
mysql> show profile for query 1;
+----------------------+-----------+
| Status | Duration |
+----------------------+-----------+
| (initialization) | 0.0000699 |
| Opening tables | 0.000039 |
| System lock | 0.000008 |
| Table lock | 0.000014 |
| init | 0.000043 |
| optimizing | 0.000396 |
| statistics | 0.000024 |
| preparing | 0.000079 |
| Creating tmp table | 0.000118 |
| executing | 0.000008 |
| Copying to tmp table | 0.871251 |
| Sorting result | 0.000063 |
| Sending data | 0.009601 |
| end | 0.000017 |
| removing tmp table | 0.000028 |
| end | 0.000009 |
| query end | 0.000006 |
| freeing items | 0.000015 |
| closing tables | 0.001449 |
| logging slow query | 0.000009 |
+----------------------+-----------+
20 rows in set (0.02 sec)
只查看cpu和io:
mysql>show profile cpu,block io for query 1;
+----------------------+-----------+-----------+------------+
| Status | Duration | CPU_user | CPU_system |
+----------------------+-----------+-----------+------------+
| (initialization) | 0.0000699 | 0 | 0 |
| Opening tables | 0.000039 | 0 | 0 |
| System lock | 0.000008 | 0 | 0 |
| Table lock | 0.000014 | 0 | 0 |
| init | 0.000043 | 0 | 0.001 |
| optimizing | 0.000396 | 0 | 0 |
| statistics | 0.000024 | 0 | 0 |
| preparing | 0.000079 | 0 | 0 |
| Creating tmp table | 0.000118 | 0 | 0 |
| executing | 0.000008 | 0 | 0 |
| Copying to tmp table | 0.871251 | 0.59391 | 0.253961 |
| Sorting result | 0.000063 | 0 | 0 |
| Sending data | 0.009601 | 0.001 | 0.003 |
| end | 0.000017 | 0 | 0 |
| removing tmp table | 0.000028 | 0 | 0 |
| end | 0.000009 | 0 | 0 |
| query end | 0.000006 | 0 | 0 |
| freeing items | 0.000015 | 0 | 0 |
| closing tables | 0.001449 | 0.0009990 | 0.001 |
| logging slow query | 0.000009 | 0 | 0 |
+----------------------+-----------+-----------+------------+
20 rows in set (0.00 sec)
清零:
mysql> set profiling=0;
Query OK, 0 rows affected (0.00 sec)
- MySQL Query Profiler(性能分析工具)的使用方法
- MySQL Query Profiler的使用方法
- EQATEC Profiler: 免费的.NETCF代码性能分析工具
- EQATEC Profiler: 免费的.NETCF代码性能分析工具
- 使用Trepn Profiler工具分析Dragonboard410c的功耗和性能(一)
- 使用Trepn Profiler工具分析Dragonboard410c的功耗和性能(二)
- MySQL Query Profiler 的使用 show profiles
- Unity的Profiler性能分析
- Unity的Profiler性能分析
- Snapdragon Profiler性能监测和分析工具
- NVIDIA profiler性能分析工具使用
- MySQL Query Profiler
- 使用mysql query profiler
- Mysql Query Profiler
- MySQL Query Profiler
- MySQL Query Profiler使用
- Sql2005性能工具(SQL Server Profiler和数据库引擎优化顾问)使用方法详解
- Sql2005性能工具(SQL Server Profiler和数据库引擎优化顾问)使用方法详解
- Spring缓存注解@Cache,@CachePut , @CacheEvict,@CacheConfig的介绍和redi的整合使用
- linux常用命令
- vue项目打包到tomcat下运行
- 欢迎使用CSDN-markdown编辑器
- Leaflet加载图片-imageoverlay
- MySQL Query Profiler(性能分析工具)的使用方法
- JAVA NIO 概述及例子
- IOS实现3DTouch功能
- 【数据结构】【计算机视觉】并查集(disjoint set)结构介绍
- Androidstudio最简单的打成jar包的方法
- CSS盒子模型
- static作用(修饰函数、局部变量、全局变量)
- ant+jmeter+jenkins搭建持续性能测试,接口测试平台
- nginx 静态文件访问不到 403