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

Tags: SQL

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.



Reader Comments

Jan 30, 2007 at 12:59 PM // reply »
10 Comments

Hi Ben,

Please keep us informed on your method of achieving this.

Thanks.


Feb 27, 2007 at 6:04 AM // reply »
1 Comments

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.


Oct 21, 2007 at 4:47 AM // reply »
3 Comments

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.


Jun 20, 2008 at 12:03 PM // reply »
1 Comments

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.


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 25, 2013 at 10:08 AM
Using "//" And ".//" Expressions In XPath XML Search Directives In ColdFusion
@Ben, my question is that i want the current node with its tag and its parent node. i just want only that data. So, give me the solution for that. and remember solution is working on " xpath 1.0 ... read »
May 25, 2013 at 10:01 AM
Using "//" And ".//" Expressions In XPath XML Search Directives In ColdFusion
hey ben, i want get my current node tag and also want the root node tag withing. So, how can i fix it.. ! ... read »
May 24, 2013 at 5:39 PM
Ask Ben: Manually Enforcing Basic HTTP Authorization In ColdFusion
@Adam Oops! My mistake! I hadn't gotten that far in my testing - I'm still baby stepping my way through the process. ... read »
May 24, 2013 at 5:13 PM
Ask Ben: Manually Enforcing Basic HTTP Authorization In ColdFusion
Hi Jason, Thanks for checking up on that, but I still stand firm on my position. :) There are actually two listLast()'s in use, and you're right that the one using a space as a delimiter is fine. ... read »
May 24, 2013 at 4:45 PM
Ask Ben: Manually Enforcing Basic HTTP Authorization In ColdFusion
@Ben I have been lurking your site for quite some time, and haven't stepped up to comment until today. Thanks for all the great info - keep it up! @Adam I believe you are mistaken... as the commen ... read »
May 24, 2013 at 11:21 AM
Strange Interaction Between DeserializeJson(), ArrayContains(), And Database Values In ColdFusion
@WebManWalking, Ha ha, let's us never speak of justifying "##" notation again :P ... read »
May 24, 2013 at 11:18 AM
Strange Interaction Between DeserializeJson(), ArrayContains(), And Database Values In ColdFusion
@Ben, Ah, so it was indeed how I vaguely remembered it to be: A direct assignment value = users.id[ i ] causes value to retain the sticky datatype of the query column. Although unnecessary in ... read »
May 24, 2013 at 9:11 AM
Preventing Links In Standalone iPhone Applications From Opening In Mobile Safari
@Brandon, Hi, No, I haven't been able to do that. I have just kept it as it is. ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools