监视SQL SERVER中SQL查询的进度 [英] Monitoring the progress of an SQL query in SQL SERVER

查看:463
本文介绍了监视SQL SERVER中SQL查询的进度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到一个类似的问题,询问如何监视备份/恢复操作的进度:

I saw a similar question which asked how to monitor the progress of a backup / restore operation: Is there a SQL script that I can use to determine the progress of a SQL Server backup or restore process?

我想知道是否有类似的查询/方式来查看查询剩余的时间,直到结束。
例如,一个查询通常耗用时间为5分钟。
我想知道在查询执行前它将结束多少时间。

I would like to know if there's a similar query / way to see how much time the query has left until it will end. For example, one query usually has elapsed time of 5 minutes. I would like to know how much time is left until it will end DURING the query's execution.

提前感谢,
Roni。 p>

Thanks in advance, Roni.

推荐答案

没有办法知道剩下多少时间。查询的运行时间取决于许多超出实际查询本身的事情:锁定/阻止其他查询,消耗资源的其他进程(cpu /磁盘使用),操作系统,网络等等。如果您的5分钟查询正在运行,别人开始一个大报告,你的查询可能现在运行5:30。如果有人开始下载一个大文件,并拥有所有的网络带宽怎么办?如果操作系统决定在后台执行某些操作,则会发生什么情况等。在返回所有行之前,查询未完成,但可以在可变时间范围内运行。

there is no way to know how much time is left. a query's run time depends on many things beyond the actual query itself: locking/blocking of other queries, other processes consuming resources (cpu/disk usage), the operating system, network, etc. What if your 5 minute query is running, yet someone else kicks off a large report, your query may run 5:30 now. What if the someone starts to download a large file and hogs all the network bandwidth? What if the OS decides to do something in the background, etc. Until all the rows are returned, the query isn't done, but it can run in an variable time frame.

这篇关于监视SQL SERVER中SQL查询的进度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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