Internal Query Processor Error: The Query Processor Ran Out Of Stack Space During Query Optimization
Posted January 30, 2007 at 12:34 PM by Ben Nadel
Wooohooo! I got a SQL server error that I have never seen before:
Internal Query Processor Error: The Query Processor Ran Out Of Stack Space During Query Optimization.
I am working on an old report for a client that originally had a small set of data and now has an ENOURMOUS set of data. Looks like it's time to start breaking a query up into smaller queries - give the SQL server less to worry about.
What Other People Are Searching For
Please keep us informed on your method of achieving this.
Is it a coincidence that the filename of this page starts with "500"? I find that I sometimes get this error when combining more than 500 fields in one expression in a SQL Server query.
Microsoft offers the following solution for this problem: http://support.microsoft.com/kb/288095 however I would guess that there must be a better (and faster) way to get around this.
We received this error due to a bug that kept on appending items to a list that we used in an IN clause of a SQL Statement.
It blew up since the IN statement had 35,000 arguments.
Creating a temp table per the MS article is probably the best solution since you can throw a clustered index on the column.
This part of the MS article scared me a bit:
In some cases, SQL Server may actually shutdown as a result of the stack overflow.