SQL Server 简单插入语句超时
我有一个有 6 列的简单表格.大多数情况下,对它的任何插入语句都可以正常工作,但偶尔我会收到 DB Timeout 异常:超时已过.操作完成之前超时时间已过或服务器没有响应.声明已终止.
I have a simple table with 6 columns. Most of the time any insert statements to it works just fine, but once in a while I'm getting a DB Timeout exception: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.
超时设置为 10 秒.
Timeout is set to 10 seconds.
我应该提到我正在使用 NHibernate 并且该语句在插入本身之后还包含一个select SCOPE_IDENTITY()".
I should mention that I'm using NHibernate and that the statement also include a "select SCOPE_IDENTITY()" right after the insert itself.
我的想法是该表被锁定或其他原因,但当时该表上没有其他语句在运行.
My thought was that the table was locked or something, but there were no other statements running on that table at that time.
所有的插入都很简单,在sql profiler中一切正常,表没有索引,只有PK(页面完整度:98.57 %).
All the inserts are very simple, everything looks normal in sql profiler, the table has no indices but the PK (Page fullness: 98.57 %).
关于我应该寻找什么的任何想法?
Any ideas on what should I look for?
谢谢.
推荐答案
我们的 QA 有一些 Excel 连接返回了大结果集,这些查询在一段时间内被 ASYNC_NETWORK_IO 的 WaitType 暂停.在此期间,所有其他查询均超时,因此与特定插入无关.
Our QA had some Excel connections that returned big result sets, those queries got suspended with WaitType of ASYNC_NETWORK_IO for some time. During this time all other queries timed out, so that specific insert had nothing to do with it.
相关文章