MySQL WorkBench - How come the Duration time + Fetch time < real waiting time

和自甴很熟 提交于 2019-12-10 17:18:15

问题


I am running a query in mySQL Workbench. It takes 5 minutes from the start of the query to the display of the results. Nevertheless, the following "processing" times are shown (in WorkBench output panel):

  • Duration : 0.000 sec
  • Fetch : 2.562 sec

Question : how can this difference be explained : 5 min vs 2.562 sec ?

BTW : this question is not a duplicate of people asking what the difference between duration and fetch is...


回答1:


I guess the problem is with Duration, the query execution time. I suspect the stats are not taking into account disk access and you might be missing some index. The other reason is that there can be waiting times for locking, which is supposed to be accounted for.

You can do the following to have more details on where your query spends time.

set profiling=1;
<run your query>
show profiles;
show profile for query 1;


来源:https://stackoverflow.com/questions/27042246/mysql-workbench-how-come-the-duration-time-fetch-time-real-waiting-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!