如何在mysql命令行中查看高精度查询时间? [英] How do I see high-precision query times in mysql command line?

查看:268
本文介绍了如何在mysql命令行中查看高精度查询时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些优化工作,并且我注意到在某些MySQL转储中,人们发表在文章和问题中(实际上我现在再也找不到了),执行时间非常精确(0.05985215秒,而不是0.06秒).

I'm working through some optimization work, and I've noticed that in some mysql dumps people post in articles and questions (which I cannot find again now that I'm actually looking), there are high-precision execution times (0.05985215 sec instead of 0.06 sec).

如何在命令行中查看这些更精确的时间?

How can I see these more precise times for my queries on the command line?

编辑

例如:

+----------+
| COUNT(*) |
+----------+
| 11596    |
+----------+
1 row in set (0.05894344 sec)

使用性能分析使我无法自拔,但是产生的输出时间太长,我必须记住启用它.我只是在寻找一个简单的高精度持续时间.

Using profiling gets me part of the way there, but produces an output too long, and I have to remember to enable it. I am just looking for a simple high-precision duration.

SET profiling = 1;
<query>
SHOW PROFILES;

给我这样的东西:

+----------------------+-----------+
| Status               | Duration  |
+----------------------+-----------+
| (initialization)     | 0.000005  |
| checking permissions | 0.00001   |
| Opening tables       | 0.000499  |
| Table lock           | 0.000071  |
| preparing            | 0.000018  |
| Creating tmp table   | 0.00002   |
| executing            | 0.000006  |
| Copying to tmp table | 6.565327  |
| Sorting result       | 0.000431  |
| Sending data         | 0.006204  |
| query end            | 0.000007  |
| freeing items        | 0.000028  |
| closing tables       | 0.000015  |
| logging slow query   | 0.000005  |
+----------------------+-----------+
14 rows in set (0.00 sec)

推荐答案

似乎最好的答案是启用概要分析.没有其他线索可以提出来.

It seems that the best answer to this is to enable profiling. There have been no other leads that pan out.

最佳答案,使用查询分析.

Best answer, use query profiling.

SET profiling = 1;
<query>
SHOW PROFILES;

这篇关于如何在mysql命令行中查看高精度查询时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆