| Posted by Emin on 09/12/07 19:42 
Dear Experts,
 While running a query with a lot of joins, I got the following error
 message:
 
 -------------------------------------------------------------------
 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.
 -------------------------------------------------------------------
 
 The really strange part is that if I left the clause "ORDER BY myDate"
 off the query I didn't get the error. My work around was to put the
 results of the query into a temporary table called #myTemp and then do
 "SELECT * FROM #myTemp ORDER BY myDate".
 
 1. Is there a way to tell the query processor to use more resources so
 I don't get this error?
 
 2. Since it seems like the ORDER BY clause is causing the problem, is
 there a way to tell the query analyzer to just do the query and then
 order everything instead of trying to be too clever?
 
 3. Is there a better way to solve this problem than using a temporaray
 table?
 
 Thanks,
 -Emin
 [Back to original message] |