mysql的sql性能分析器(3)
来源:未知 责任编辑:责任编辑 发表时间:2014-05-26 11:02 点击:次
12 rows in set (0.03 sec)
mysql> show profile for query 8;
+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| (initialization) | 0.000064 |
| Opening tables | 0.000018 |
| System lock | 0.00001 |
| Table lock | 0.000013 |
| init | 0.00002 |
| optimizing | 0.00001 |
| executing | 0.002589 |
| end | 0.000459 |
| query end | 0.000007 |
| freeing items | 0.000015 |
| closing tables | 0.000012 |
| logging slow query | 0.000005 |
+--------------------+----------+
12 rows in set (0.00 sec)
mysql> select sum(format(duration,6)) as duration from information_schema.profiling where query_id=7;
+----------+
| duration |
+----------+
| 0.003688 |
+----------+
1 row in set (0.02 sec)
mysql> select sum(format(duration,6)) as duration from information_schema.profiling where query_id=8;
+----------+
| duration |
+----------+
| 0.003222 |
+----------+
1 row in set (0.00 sec)
mysql>
从如上的信息可以看出这两个sql的profile统计信息里,前4项差别比较大,这是两个sql主要区别,第二次查询有很多
缓存了了。SQL 性能分析器可以帮助我们对一些比较难以确定性能问题的SQL 进行诊断,找出问题根源。
------end-----
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>