Sql server query processor has exhausted internal resources

Query:

update mytable set mycol = null where id in ( 583048, 583049, ... (50000 more) ) 

Message: The query processor has run out of internal resources and could not create a query plan. This is a rare event and is only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify your request. If you think you received this message in error, contact Customer Service for more information.

My query is very simple, how should I write for it to work fine?

+4
source share
1 answer

Paste the list of values ​​into the #temp table, then use in .

As explained in this answer , a large number of in values ​​can cause it to end from the stack, as they will be expanded to OR

See also related connection element.

+4
source

All Articles