Mysql分析-profile详解
来源:互联网 发布:折扇淘宝 编辑:程序博客网 时间:2024/06/04 00:37
一。前言
当我们要对某一条sql的性能进行分析时,可以使用它。
Profiling是从 mysql5.0.3版本以后才开放的。
启动profile之后,所有查询包括错误的语句都会记录在内。
关闭会话或者set profiling=0 就关闭了。(如果将profiling_history_size参数设置为0,同样具有关闭MySQL的profiling效果。)
此工具可用来查询SQL执行状态,System lock和Table lock 花多少时间等等,
对定位一条语句的I/O消耗和CPU消耗 非常重要。(SQL 语句执行所消耗的最大两部分资源就是IO和CPU)
--在mysql5.7之后,profile信息将逐渐被废弃,mysql推荐使用performance schema
二。流程
简易流程大概如下:
三。含义分析
上图中横向栏意义
+----------------------+----------+----------+------------+
"Status": "query end", 状态
"Duration": "1.751142", 持续时间
"CPU_user": "0.008999", cpu用户
"CPU_system": "0.003999", cpu系统
"Context_voluntary": "98", 上下文主动切换
"Context_involuntary": "0", 上下文被动切换
"Block_ops_in": "8", 阻塞的输入操作
"Block_ops_out": "32", 阻塞的输出操作
"Messages_sent": "0", 消息发出
"Messages_received": "0", 消息接受
"Page_faults_major": "0", 主分页错误
"Page_faults_minor": "0", 次分页错误
"Swaps": "0", 交换次数
"Source_function": "mysql_execute_command", 源功能
"Source_file": "sql_parse.cc", 源文件
"Source_line": "4465" 源代码行
+----------------------+----------+----------+------------+
上图中纵向栏意义
+----------------------+----------+----------+------------+
starting:开始
checking permissions:检查权限
Opening tables:打开表
init : 初始化
System lock :系统锁
optimizing : 优化
statistics : 统计
preparing :准备
executing :执行
Sending data :发送数据
Sorting result :排序
end :结束
query end :查询 结束
closing tables : 关闭表 /去除TMP 表
freeing items : 释放物品
cleaning up :清理
+----------------------+----------+----------+------------+
一般情况下,常用以下语句也就够了 :
四。相关外链
另外附上profiling 的学习质料
profiling 基础
http://www.tuicool.com/articles/ZFrUzia
http://www.xaprb.com/blog/2006/10/12/how-to-profile-a-query-in-mysql/
http://www.xaprb.com/blog/2006/10/15/a-case-study-in-profiling-queries-in-mysql/
http://www.xaprb.com/blog/2006/10/17/mysql-profiling-case-study-part-2/
profiling 进阶
http://www.mysqlperformanceblog.com/2009/01/19/profiling-mysql-stored-routines/
http://www.mysqlperformanceblog.com/2008/05/18/wanted-better-memory-profiling-for-mysql/maatkit–perldoc mk-query-profiler
profiling高级
http://dev.mysql.com/tech-resources/articles/pro-mysql-ch6.html
http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html
profiling骨灰级
http://www.scribd.com/doc/2669413/DTrace-and-MySQL-Presentation
http://forge.mysql.com/wiki/Using_DTrace_with_MySQL
http://wikis.sun.com/display/BluePrints/Optimizing+MySQL+Database+Application+Performan
http://blog.csdn.net/lihuayong/article/details/42044593
本文地址:http://blog.csdn.net/ty_hf/article/details/54895026
阅读全文
0 0
- Mysql分析-profile详解
- Mysql分析-profile详解
- Mysql分析-profile详解
- Mysql profile分析查询
- Mysql show profile 详解
- Mysql 慢查询和profile分析工具
- mysql profile explain slow_query_log分析优化查询
- MySQL使用profile分析SQL执行状态
- MySQL性能分析工具profile使用教程
- mysql使用profile分析语句性能消耗
- MySQL性能分析工具profile使用教程
- mysql性能分析工具--show profile
- MySQL使用profile分析SQL执行状态
- MySql 使用SHOW PROFILE 进行SQL 分析
- MySql 使用SHOW PROFILE 进行SQL 分析
- mysql--profile
- mysql查询性能分析(show status,show profile,explain)
- MySQL性能分析工具profile的使用(1)
- Intellij IDEA使用笔记(持续更新...)
- Zxing二维码精简(竖屏、拉伸处理、扫描框大小和扫描线移动)
- HDU1166 疑兵布阵 【线段树】
- 机器学习(Mitchell)1
- Kettle循环抽取数据做增量
- Mysql分析-profile详解
- 修改hosts不管用。为什么修改127.0.0.1指向的域名,访问域名却弹出别的网站
- logback日志配置
- lvs-keepavlied 安装配置
- 改造Vmware里的FastDFS为Docker
- centos7 设置防火强的问题
- 欢迎使用CSDN-markdown编辑器
- ACM DP Partitioning by Palindromes
- 使用DsoFramer控件时遇到的问题及解决