查询处理器无法启动并行查询执行所需的线程资源

发布于 2024-12-10 10:00:45 字数 306 浏览 1 评论 0原文

这是什么意思以及如何解决。

我正在运行多线程 C# 应用程序,并且在访问数据库时发生此错误。

查询处理器无法启动并行查询执行所需的线程资源。

我在每个查询中都使用“using statements”,因此我认为连接在使用后会被丢弃。

我如何监控导致此情况的原因?这种情况在一段时间后(例如至少 1 小时后)开始发生。

Windows 7 64 位 sp1 16 GB 内存 Visual Studio 2010 mssql 2008 r2 核心 i7 2600 @ 4.5 ghz

What does this mean and how to solve.

I am running multi threaded c# application and this error happens when accessing database.

The query processor could not start the necessary thread resources for parallel query execution.

I am using "using statements" at every query so i suppose connections are getting disposed of after used.

How can i monitor what is causing this ? This is starting happening after some time like at least after 1 hour.

Windows 7 64 bit sp1 16 gb ram visual studio 2010 mssql 2008 r2 core i7 2600 @ 4.5 ghz

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

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

发布评论

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

评论(4

梦里寻她 2024-12-17 10:00:45

在 dba.stackexchange.com 上有一个更好的答案,包含更多讨论和详细信息。

https://dba.stackexchange.com/questions/47237/need-理解并行查询执行错误

There is a much better answer with more discussion and details over at dba.stackexchange.com.

https://dba.stackexchange.com/questions/47237/need-to-understand-parallel-query-execution-error

音栖息无 2024-12-17 10:00:45

该问题表明您的 SQL Server 线程已经很忙,无法分配任何其他线程来处理您的请求。如果您正在执行多个批处理,您还可以尝试通过将连接字符串设置为“MultipleActiveResultSets=true”来启用 MARS(多个活动结果集)选项。

The problem indicates that your SQL server threads are already busy and unable to allocate any other threads to handle your request. You can also try to enable MARS (Multiple Active Result Sets) option in the connection string by setting it "MultipleActiveResultSets=true" if you're executing multiple batches.

无人接听 2024-12-17 10:00:45

此错误来自构建执行计划,该计划试图并行化复杂的查询。立即显示,查询不等待超时。简单的查询很有魅力。

解决方案是禁用最大并行度 将其设置为 1。我不确定此设置对性能的影响,但由于服务器上有许多并发查询,因此这不应该是问题。

This error is from building execution plan, which is trying to parallelize complex queries. It is displayed immediately, query doesn't wait for timeout. Simple queries work as a charm.

The solution was to disable Max degree of parallelism by setting it to 1. I'm not sure about performance effects of this setting, but as there are many concurrent queries on the server anyway, it shouldn't be an issue.

歌枕肩 2024-12-17 10:00:45

我遇到了同样的问题,我试图创建索引,但收到错误“查询处理器无法启动并行查询执行所需的线程资源”,我的 MAXDOP 设置为 64,我检查了我的 CPU 数量有 - 它们是 24,所以我将 MAXDOP 设置为 24 ,结果是相同的错误,但是当我将 MAXDOP 设置为 1 并执行查询时,它起作用了,不确定副作用,但我再次将其设置回来到 24,等于处理器的数量。

希望这对你有帮助!

I had the same issue, I was trying to create Index but I got the error "The query processor could not start the necessary thread resources for parallel query execution", My setting of MAXDOP was to 64, I have checked the number of CPUs I have - they were 24, SO I set MAXDOP to 24 , the result was the same error, But when I set to MAXDOP to 1, and executed the Query it worked, Not sure about the side effects but again I set it back to 24 which is equal to number of processors.

Hope this helps you !!!!

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