Share via

Unable to create plan for sql query

ACDBA 421 Reputation points
2023-09-13T06:36:54.6933333+00:00

Hi All, When i run this query below error is throwing. idlist is around 30K. Is there any limit in that number of entries in sql server and any changes to be done in SQL server configuration to fix this rather than modifying the query?

string delQueryItems = "DELETE FROM data_sheet_data where id in (" + String.Join(",",idList) + ")"; 

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.

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

Answer accepted by question author

Olaf Helper 47,621 Reputation points
2023-09-13T06:50:39.38+00:00

idlist is around 30K

That's more then a bad idea using the IN operator and well documented that it will into an error, see IN (Transact-SQL) => Remark

Use a (temp) table for the value list instead.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.