开发者

SQL Server Query Taking Too Long Handling?

开发者 https://www.devze.com 2023-02-19 10:10 出处:网络
I have a complex query inside a stored proc. Within the proc itself, I would like to judge how long things are taking and do a RAISERROR if I think a 30-second threshhold has been passed (which will f

I have a complex query inside a stored proc. Within the proc itself, I would like to judge how long things are taking and do a RAISERROR if I think a 30-second threshhold has been passed (which will force people to do some optimizations).开发者_如何学运维

Can anyone say a decent way to make that happen, all within TSQL code?

Thanks.


You could issue a set query_governor_cost_limit before commencing on the potentially costly query. However, I believe that this cancels the query before it starts (if it's estimated to take too long), rather than cancelling it when the limit is actually reached.

0

精彩评论

暂无评论...
验证码 换一张
取 消