如何在mysql中获取加载时间(以毫秒或微秒为单位) [英] how to get load time in milliseconds or microseconds in mysql

查看:253
本文介绍了如何在mysql中获取加载时间(以毫秒或微秒为单位)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了很多,但是找不到一个简单的方法来获得它:

I' ve searched and searched, but I wasn't able to find an easy way to get this:

Query OK, 50000 rows affected (0.35 sec) 

以毫秒或微秒为单位.

我该如何实现?

推荐答案

该时间是由mysql监视应用程序计算的,而不是由mysql服务器完成的.您不能通过执行(例如)select last_query_execution_time()(这很好)来以编程方式检索该东西.

That time's calculated by the mysql monitor application and isn't done by the mysql server. It's not something you can retrieve programatically by doing (say) select last_query_execution_time() (which would be nice).

您可以通过在应用程序中进行计时,在调用查询函数之前和之后占用系统时间来粗略地模拟它.希望与mysql部分相比,客户端的开销将最小.

You can simulate it in a coarse way by doing the timing in your application, by taking system time before and after calling the query function. Hopefully the client-side overhead would be minimal compared to the mysql portion.

这篇关于如何在mysql中获取加载时间(以毫秒或微秒为单位)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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