Forum Discussion
bboissard
Oct 29, 2024Copper Contributor
SQL Server failing to execute extremely complex queries
A query is failing with this error message on a customer environment: The query processor ran out of internal resources and could not produce a query plan.
This is a rare event and only expected fo...
bboissard
Nov 06, 2024Copper Contributor
In SQL Server logs, I can find:
Error : 8623, Severity : 16, State : 1.
According to the documentation:
https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/mssqlserver-8623-database-engine-error?view=sql-server-ver16
State 1 means:
The query timed out due to the plan being too complex
It does not look like a memory issue, which would be State 2.
So I won't investigate more on the memory side.
I tried LEGACY_CARDINALITY_ESTIMATION and COMPATIBILITY_LEVEL = 110 without much success either.
rodgerkong
Nov 06, 2024Iron Contributor
So, you have to optimize the query.