This is basically the same question as "Fast query runs slow in SSRS" however nothing in there I could see worked for me.
Context: Created a Report Builder dataset to use for my report, query is:
SELECT DISTINCT A.A
, A.B
, A.C
, A.A + ', (' + A.B + '), : ' + CAST(A.C AS VARCHAR) D
FROM Table1 X
INNER JOIN TableA A ON X.Key = A.Key
WHERE (X.Col1 IN (@Param1))
AND (X.Col2 IN (@Param2))
UNION
SELECT '(All)', '(Select to apply all)', 0, '<APPLY ALL>'
ORDER BY C, A
OPTION (OPTIMIZE FOR UNKNOWN)
I have 3 multi valued parameters. The first (@Param1) and second (@Param2) lists load fine and the second is not dependent on the first. The third list which uses the dataset described above is dependent on both 1 and 2 as you can see from the query above.
I add the OPTION (OPTIMIZE FOR UNKNOWN) clause as an attempt to speed it up but to no avail. I do not even know how to declare a multivalue parameter anyhow so this was my only option to try at this stage.
After I am finished selecting values from my second dropdown/parameter and move to the third parameter the report loading icon thing churns for about 5 seconds than it just halts and nothing happens after that and I never get to select from my third dropdown unless I am prepared to wait until it finishes but that would seem to be about 20 minutes, so then after a while I just kill the web-page and start again. When I run the report query in SQL Server in runs in a second and when I run thru the report in the Report Builder IDE it works fine a little delay like seconds as compared to 20 minutes however running via SharePoint/SSRS it takes 20 minutes.
Does anyone have a suggestion to try?
UNION
instead of aUNION ALL
? – stubaker