SQL Server堆栈溢出故障排除错误

时间:2022-08-22 22:48:05

How can I effectively troubleshoot this error?

如何有效地解决此错误?

The query processor ran out of stack space during query optimization. Please simplify the query.

查询处理器在查询优化期间耗尽了堆栈空间。请简化查询。

Msg 8621, Level 17, State 2

Msg 8621,Level 17,State 2

I've tried to attaching profiling, but I'm not sure I have the right messages selected. I do see the error in there. The Estimated Execution Plan gives this error as well.

我试图附加分析,但我不确定我是否选择了正确的消息。我确实看到了错误。估计执行计划也会出现此错误。

The sproc I am calling is just doing a really simple UPDATE on one table. There is one UPDATE trigger, but I disabled it, yet it still is giving me this error. I even took the same UPDATE statement out and manually supplied the values. It doesn't return as fast, and still gives me the error.

我调用的sproc只是在一个表上做了一个非常简单的UPDATE。有一个UPDATE触发器,但我禁用了它,但它仍然给我这个错误。我甚至拿出了相同的UPDATE语句并手动提供了值。它没有快速返回,仍然给我错误。

Edit: OK, my generated script is setting the PK. So if I set the PK and another column, I get this error. Any suggestions along those lines?

编辑:好的,我生成的脚本正在设置PK。因此,如果我设置PK和另一列,我会收到此错误。这些方面有什么建议吗?

3 个解决方案

#1


3  

There's a microsoft KB article about this.

有关于此的微软知识库文章。

Basically it's a bug and you need to update. I'm assuming you are running SQL Server 2005 sp2?

基本上这是一个bug,你需要更新。我假设您正在运行SQL Server 2005 sp2?

#2


0  

There are a great number of FK's that were being referenced by this PK. I changed our code not to update that PK any further.

这个PK引用了大量的FK。我更改了代码,不再更新PK。

#3


0  

This isn't always a bug! Sounds like Daniel was able to come to the conclusion that the query wasn't as simple as he originally thought.

这并不总是一个错误!听起来丹尼尔能够得出的结论是,查询并不像他原先想象的那么简单。

This article seems to answer a similar question as the one Daniel had. I just ran into the same error for a different (legitimate) reason as well. Dynamic SQL being run on a database with data no one anticipated resulted in a single select statement with hundreds of tables.

这篇文章似乎回答了与丹尼尔一样的问题。我也因为不同的(合法的)原因而遇到了同样的错误。在没有人预料到的数据的数据库上运行动态SQL会导致包含数百个表的单个select语句。

#1


3  

There's a microsoft KB article about this.

有关于此的微软知识库文章。

Basically it's a bug and you need to update. I'm assuming you are running SQL Server 2005 sp2?

基本上这是一个bug,你需要更新。我假设您正在运行SQL Server 2005 sp2?

#2


0  

There are a great number of FK's that were being referenced by this PK. I changed our code not to update that PK any further.

这个PK引用了大量的FK。我更改了代码,不再更新PK。

#3


0  

This isn't always a bug! Sounds like Daniel was able to come to the conclusion that the query wasn't as simple as he originally thought.

这并不总是一个错误!听起来丹尼尔能够得出的结论是,查询并不像他原先想象的那么简单。

This article seems to answer a similar question as the one Daniel had. I just ran into the same error for a different (legitimate) reason as well. Dynamic SQL being run on a database with data no one anticipated resulted in a single select statement with hundreds of tables.

这篇文章似乎回答了与丹尼尔一样的问题。我也因为不同的(合法的)原因而遇到了同样的错误。在没有人预料到的数据的数据库上运行动态SQL会导致包含数百个表的单个select语句。