查询超时会发生什么? [英] What Happens To a Query If It Times Out?

查看:71
本文介绍了查询超时会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个查询发送到我的SQL-Server数据库,它花费了30秒钟以上,并且我的程序引发了SQL Query Timeout异常.该查询是否还在我的数据库中徘徊,或者在引发异常后立即终止?

Let's say I have a query that is sent to my SQL-Server database, it takes more than 30 seconds, and my program throws an SQL Query Timeout exception. Is the query still chugging along on my database or does it get terminated as soon as the exception is thrown?

推荐答案

客户端向发出查询超时信号使用关注事件的服务器.注意事件只是一个TDS数据包的不同类型SQL服务器客户端可以发送给它.在除了连接/断开连接,T-SQL批处理和RPC事件,客户端可以向服务器发出注意信号.一个注意告诉服务器取消连接当前正在执行尽快查询(如果有)可能的.注意力不集中回滚未完成的交易,它不会停止当前正在执行一角钱查询-服务器中止为它所做的一切下一个可用的连接机会.通常会发生这种情况很快,但并非总是如此.

A client signals a query timeout to the server using an attention event. An attention event is simply a distinct type of TDS packet a SQL Server client can send to it. In addition to connect/disconnect, T-SQL batch, and RPC events, a client can signal an attention to the server. An attention tells the server to cancel the connection's currently executing query (if there is one) as soon as possible. An attention doesn't rollback open transactions, and it doesn't stop the currently executing query on a dime -- the server aborts whatever it was doing for the connection at the next available opportunity. Usually, this happens pretty quickly, but not always.

来源没有查询超时之类的东西...

这篇关于查询超时会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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