查询处理器无法启动并行查询执行所需的线程资源
这是什么意思以及如何解决。
我正在运行多线程 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 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
该问题表明您的 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.
此错误来自构建执行计划,该计划试图并行化复杂的查询。立即显示,查询不等待超时。简单的查询很有魅力。
解决方案是禁用最大并行度 将其设置为 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.
我遇到了同样的问题,我试图创建索引,但收到错误“查询处理器无法启动并行查询执行所需的线程资源”,我的 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 !!!!