August 6, 2013 at 4:18 pm
Hi
Can anyone tell me if there is a limit to how many entries there can be in an in?
As in where somevalue in ('Fred','George','Dave'....)
The reason I ask is I have a query that was created by SSRS, it creates an 'in' with 20975 entries and it makes SQL sever respond with
"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 has over 7 Gb of RAM allocated.
Any help would be much appretialed
August 6, 2013 at 5:23 pm
From Books Online:
Including an extremely large number of values (many thousands) in an IN clause can consume resources and return errors 8623 or 8632. To work around this problem, store the items in the IN list in a table.
Error 8623:
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.
Error 8632:
Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 6, 2013 at 10:00 pm
Thanks for that, I'm not sure that Books on Line advice about putting the values in a table are that helpful for SSRS, but it's good stuff in general.
thanks
August 6, 2013 at 11:15 pm
andymay-496937 (8/6/2013)
Thanks for that, I'm not sure that Books on Line advice about putting the values in a table are that helpful for SSRS, but it's good stuff in general.thanks
Where is the "IN" list coming from?
--Jeff Moden
Change is inevitable... Change for the better is not.
August 7, 2013 at 1:39 am
andymay-496937 (8/6/2013)
Thanks for that, I'm not sure that Books on Line advice about putting the values in a table are that helpful for SSRS, but it's good stuff in general.
Well, to be honest you can do that or you can reduce the number of values until the query runs, or you can throw memory at the problem which might help or might not. Not all that many solutions, especially if you feel that the common solution isn't helpful.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 7, 2013 at 3:11 am
andymay-496937 (8/6/2013)
Thanks for that, I'm not sure that Books on Line advice about putting the values in a table are that helpful for SSRS, but it's good stuff in general.
So I don't know SSRS at all, but I am fully convinced that there are alternate solutions that does not require IN. A Reporting Services forum should be able to help you.
[font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]
August 7, 2013 at 3:27 am
The multiple parameter value option in SSRS is for end users to select multiple items. It would be pretty unusual for an end user to select 20975 different items in a report. Are you driving that list from another data set? Can you not join them together at the source instead?
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply