Search code examples
sql-servert-sqldebuggingstack-overflow

Troubleshooting SQL Server Stack Overflow error


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

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.

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?


Solution

  • 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.