`
zhengdl126
  • 浏览: 2510066 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类

mysql性能分析:mysql profiling 应用

 
阅读更多

1)先打开profiling ==> set profiling = 1;
mysql> set profiling = 1;
Query OK, 0 rows affected (0.00 sec)

2) 执行查query操作 mysql> select * from player where id = 12;

3)show profiles; 显示所有的profile 选择想查看的Query_ID
mysql> show profiles;
+———-+————+—————————————+
| Query_ID | Duration | Query |
+———-+————+—————————————+
| 1 | 0.00013125 | select * from player where id = 12 |
| 2 | 0.00017800 | SELECT DATABASE() |
| 3 | 0.00046525 | select * from player where id = 12 |
| 4 | 0.44358225 | select * from player where accid = 12 |
+———-+————+—————————————+
4 rows in set (0.00 sec)

4)查看具体的profiling

mysql> show profile cpu, block io for query 2;
+——————————–+———-+———-+————+————–+—————+
| Status | Duration | CPU_user | CPU_system | Block_ops_in | Block_ops_out |
+——————————–+———-+———-+————+————–+—————+
| starting | 0.000048 | 0.000015 | 0.000009 | 0 | 0 |
| checking query cache for query | 0.000069 | 0.000038 | 0.000019 | 0 | 0 |
| Opening tables | 0.000019 | 0.000012 | 0.000006 | 0 | 0 |
| System lock | 0.000007 | 0.000005 | 0.000002 | 0 | 0 |
| Table lock | 0.000064 | 0.000042 | 0.000022 | 0 | 0 |
| init | 0.000046 | 0.000030 | 0.000016 | 0 | 0 |
| optimizing | 0.000014 | 0.000009 | 0.000005 | 0 | 0 |
| statistics | 0.000068 | 0.000045 | 0.000023 | 0 | 0 |
| preparing | 0.000022 | 0.000015 | 0.000007 | 0 | 0 |
| executing | 0.000009 | 0.000005 | 0.000003 | 0 | 0 |
| Sending data | 0.000125 | 0.002605 | 0.000000 | 0 | 0 |
| end | 0.000025 | 0.000007 | 0.000000 | 0 | 0 |
| query end | 0.000027 | 0.000012 | 0.000000 | 0 | 0 |
| freeing items | 0.000034 | 0.000019 | 0.000000 | 0 | 0 |
| storing result in query cache | 0.000016 | 0.000011 | 0.000000 | 0 | 0 |
| logging slow query | 0.000006 | 0.000004 | 0.000000 | 0 | 0 |
| cleaning up | 0.000010 | 0.000006 | 0.000000 | 0 | 0 |
+——————————–+———-+———-+————+————–+—————+
17 rows in set (0.00 sec)

分享到:
评论

相关推荐

    Mysql自带profiling性能分析工具使用分享

    Mysql自带profiling性能分析工具使用分享,需要的朋友可以参考下

    高性能MySQL_第3版_超清中文带目录版[PDF]

    第2章:寻找瓶颈:基准测试(Benchmarking)与性能分析(Profiling) 32 第3章:架构优化和索引 80 第4章:查询性能优化 152 第5章:MySQL高级特性 204 第6章:优化服务器设置 265 第7章:操作系统和硬件优化 305 第...

    mysql profiling

    mysql优化之profiling的用法

    解析Mysql Profiling的使用

    profiling是个很好用的mysql性能分析工具,今儿就来试验下profiling的功能。感谢 有爱玫瑰的博文:mysql 的 sql 性能分析器主要用途是显示 sql 执行的整个过程中各项资源的使用情况。分析器可以更好的展示出不良 SQL...

    MySQL Profiling的使用

    MySQL 的Query Profiler 是一个使用非常方便的Query 诊断分析工具,通过该工具可以获取一条Query 在整个执行过程中多种资源的消耗情况。

    Mysql学习笔记

    PROFILING:性能分析工具 MysqlDUMP:备份工具 Mysql的配置文件有多个目录,顺序分别为: /etc/my.cnf /etc/mysql/my.cnf $MYSQL_HOME/my.cnf 编译目录下的my.cnf ~/.my.cnf 当Mysql启动的时候会依次读取这几个文件...

    High Performance MySQL: Optimization, Backups, Replication, and More

    High Performance MySQL is the ...The book also includes chapters on benchmarking, profiling, backups, security, and tools and techniques to help you measure, monitor, and manage your MySQL installations.

    mysql优化(1)show命令 慢查询日志 explain profiling

    NULL 博文链接:https://asyty.iteye.com/blog/1202943

    MySQL5.1性能调优与架构设计.mobi

    ●性能优化篇从影响MySQL数据库应用系统性能的因素开始,针对性地对各个影响因素进行调优分析。如MySQL Schema设计的技巧,Query语句的性能优化方式方法及MySQL Server中SQL层和存储引擎层的优化思路。同时还分析了...

    Devart dbForge Studio for MySQL Professional Edition v7.1.13

    The Best MySQL GUI Tool You Can Find dbForge Studio for MySQL is a universal GUI for managing, developing and administrating MySQL and MariaDB databases. The tool allows to create and execute queries,...

    MySQL性能分析工具profile使用教程

    在MySQL数据库中,可以通过配置profiling参数来启用SQL剖析。该参数可以在全局和session级别来设置。对于全局级别则作用于整个MySQL实例,而session级别紧影响当前session。该参数开启后,后续执行的SQL语句都将记录...

    High Performance MySQL 2nd Edition Jun 2008

    The book also includes chapters on benchmarking, profiling, backups, security, and tools and techniques to help you measure, monitor, and manage your MySQL installations. HomePage: ...

    mysql sql语句性能调优简单实例

    mysql sql语句性能调优简单实例 在做服务器开发时,有时候对...1. 打开mysql profiling: 2. 然后执行需要调优的sql,我们这里执行两条sql,一条commit语句,另外一条就是调用上面的存储过程语句: 3. 利用profilin

    mysql优化limit查询语句的5个方法

    mysql的分页比较简单,只需要limit offset,length就可以获取数据了,但是当offset和length比较大的时候,mysql明显性能下降 1.子查询优化法 先找出第一条数据,然后大于等于这条数据的id就是要获取的数据 缺点:...

    MySQL调优利器【show profiles】

    是mysql提供可用来分析当前会话中语句执行的资源消耗情况,可以用于SQL的调优测量。 默认情况下,参数处于关闭状态,并保存最近15次的运行结果 分析步骤 1、查看当前版本sql是否支持show profiles mysql> show ...

    mysql查询优化.

    1、理解MYSQL的Query Optimizer 2、Query语句优化基本思路和原则 3、充分利用Explain 和 Profiling 4、合理设计并利用索引 5、order by、group by 和 DISTINCT优化 6、小结

Global site tag (gtag.js) - Google Analytics