I had a similar problem: a query that returns 4,000 rows and runs in 1 second on its own takes so much time in SSRS that it has expired.
It turned out that the problem was caused by the way SSRS handled the multi-valued parameter. Interestingly, if the user selected several values, the report was rendered quickly (~ 1 second), but if only one value was selected, the report should have taken several minutes.
Here is the original query, which took more than 100 times longer than needed:
SELECT ... FROM ... WHERE filename IN (@file);
I suspect the problem was that SSRS cited the entire source table (over 1 million rows) and then executed the client filter.
To fix this, I ended up passing the parameter to the query through an expression so that I can control the filter myself. That is, in the "DataSet Properties" window on the "Parameters" screen, I replaced the parameter value with the following expression:
=JOIN(Parameters!file.Value,",")
... (I also gave the result a new name: filelist), and then I updated the request to look like this:
SELECT ... FROM ... WHERE ',' + @filelist + ',' LIKE '%,' + FILENAME + ',%';
I would suggest that moving a request to a stored procedure would also be an effective way to fix the problem (since SSRS basically does the same JOIN before passing a parameter with multiple values to the stored procedure). But in my case it was a little easier to handle all this in a report.
Finally, I have to point out that the LIKE statement may not be the most efficient way to filter by a list of items, but of course it’s much simpler than the code with a shared line approach, and the report now works after about a second, so line breaks didn’t seem useful to you .