SQL server query processor ran out of internal resources(SQL Server 查询处理器耗尽内部资源)
问题描述
查询:
update mytable
set mycol = null
where id in (
583048,
583049,
... (50000 more)
)
留言:
查询处理器耗尽了内部资源,无法生成查询计划.这是一个罕见的事件,只预期极其复杂的查询或引用非常大的查询表或分区的数量.请简化查询.如果你认为您错误地收到了此消息,请联系客户支持服务以获取更多信息.
The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.
我的查询很简单,我应该如何编写它才能正常工作?
My query is very simple, how should I write it so it works ok?
推荐答案
将值列表插入到 #temp
表中,然后在其上使用 in
.
Insert the list of values into a #temp
table then use in
on that.
如解释在这个答案中,大量的 IN
值会导致它在扩展为 OR
As explained in this answer a large number of IN
values can cause it to run out of stack as they get expanded to OR
另见相关连接项
这篇关于SQL Server 查询处理器耗尽内部资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL Server 查询处理器耗尽内部资源


- 更改自动增量起始编号? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- SQL 临时表问题 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01