sql server 快速查询超时

发布于 2024-10-10 08:49:53 字数 371 浏览 0 评论 0原文

我 100% 确定这个问题是重复的,但我搜索了几个小时,但没有找到任何内容。

我的环境:windows server 2003、sql server 2005、.net 2.0 (c#)

我的问题:

当我同时运行 5 个请求时,我的存储过程之一引发超时。

如果,在 5 个请求等待期间,我在 Management Studio 中运行,我尝试使用相同的参数调用此存储过程,我会在 0 秒内得到结果:)

我尝试查看是否打开了太多连接,但我在活动监视器中看不到任何内容(我可以看到 14 个带有“等待命令”的项目)。

那么我的问题是什么?我认为这是一个配置丢失,如果是的话,你能解释一下我将如何选择这个配置的值吗?

谢谢

I'm 100% sure that this question is a duplicate but I searched for a few hours and I didn't find anything.

My environment : windows server 2003, sql server 2005 , .net 2.0 (c#)

My problem :

When I run 5 request in the same time , one of my stored proc raises a time-out.

If , during the period the 5 request are waiting, I run in Management Studio, I try to call this stored proc with the same argument, I get my results in 0sec :)

I tried to see if I have too much connection opened but I can't see anything in activity monitor (I can see 14 item with "awaiting command").

So what is my problem ? I think it's a configuration missing , if it is, can you explain me how I will choose the value of this configuration.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失去的东西太少 2024-10-17 08:49:53

您还可以尝试使用表提示更改 SP 中 select 语句的隔离级别。

例如:

SELECT col1, col2, col3 FROM Table1 WITH (READUNCOMMITTED)

还有其他几种隔离级别,但 READ UNCOMMITTED 是最低的,并且将从独占锁定的表中读取。缺点是你可能会得到脏读。

如果问题与锁定有关,这可能会有所帮助。

You can also try altering the isolation level of the select statement in the SP using a table hint.

For instance:

SELECT col1, col2, col3 FROM Table1 WITH (READUNCOMMITTED)

There are several other isolation levels but READ UNCOMMITTED is the lowest and will read from a table that is exclusively locked. The downside is you can get dirty reads.

If the issue is with locking, this might help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文