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 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.
Sorry I cannot post the actual SQL query, which must be massive, but basically it is a union of a lot of tables.
Maybe around 600 tables, maybe several thousands, I don’t know exactly how many.
For technical reasons, we cannot really simplify this query.
In the documentation:
https://learn.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server?view=sql-server-ver16
It is specified that the maximum number of tables in a select is limited only by available resources.
Is it possible to increase the size of available internal resources somehow?
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 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.Sorry I cannot post the actual SQL query, which must be massive, but basically it is a union of a lot of tables.Maybe around 600 tables, maybe several thousands, I don’t know exactly how many.For technical reasons, we cannot really simplify this query.In the documentation:https://learn.microsoft.com/en-us/sql/sql-server/maximum-capacity-specifications-for-sql-server?view=sql-server-ver16It is specified that the maximum number of tables in a select is limited only by available resources.Is it possible to increase the size of available internal resources somehow? Read More