If you haven’t heard the phrase “This report is really slow!” there are only a couple of possibilities: you don’t write or administer Reporting Services reports and are at the wrong blog, or you need to come teach me all you know!
There are many reasons a report can generate slowly. The code could be written poorly, the database could be experiencing high volume, or it could be a huge report that returns a lot of data. There are several strategies to make the report faster. You could rewrite and rewrite, tuning it like an OLTP query. You could throw more and more hardware at the server, or add bandwidth to your network. You could review the report with the business users, and try to determine if the scope could be narrowed down to return fewer results.
There’s another option to consider as well – caching a temporary copy of the report.
Caching will store a temporary copy of the report for a specified period of time. If a cache is a hidden store of objects, where is this hidden? You would find it in your ReportServerTempDB database. When a copy is stored, information is written to the dbo.ExecutionCache table.
Setting up the Cache
Pirates have to hide their treasure, so you too must sneak into Reporting Services under the cover of darkness and set up your cache.
To find it, open your report. Go to the Properties tab, and click Execution.


By default, your report will be set to “Always run this report with the most recent data”. (I’ll cover “Render this report from a report execution snapshot” in a separate post.) Here, you have three choices:
-
Do not cache temporary copies of this report – Every time a user runs the report, it will be generated. It’s like a pirate who never buries the treasure chest, but just leaves it sitting on the beach.
-
Cache a temporary copy of the report. Expire copy of report after a number of minutes – When a user runs the report with a specific set of parameters, the report is generated, and then stored in the cache for a specific number of minutes. This is a straight setting. If the report is run at 9:28 AM, and the setting is 240 minutes, it will expire at 12:28 PM the same day. Think of it as burying the treasure under three inches of sand, knowing the wind will blow away an inch an hour.
-
Cache a temporary copy of the report. Expire copy of report on the following schedule – this option allows you to have the report copy expire in cache on a day and time of your choosing. With this option, it’s like the pirate buried a timer, and the chest only pops up when he wants it to.
Does It Really Work?
Or have I been drinking the rum the pirate buried with the treasure?
I took a report from my production environment and tested it. The report was written as:
SELECT *
FROM ViewName
This view runs on the largest table in this database, and aggregates the data. (I didn’t write it. But I will be re-writing it.)
First, I ran the query in Management Studio. It returned 2 rows in 2 minutes, 53 seconds.

Then, I ran the report from Reporting Services. It executed in 2 minutes, 44 seconds.
Then, I enabled caching and set it to expire in 30 minutes. I ran it again one minute later, and it executed in less than one second.
Yes, less than one second. It just popped up.
Go ahead – find your nastiest, ugliest, longest-running report. Set up caching. Time the execution before and after. I’d love it if you posted your results in the comments!
How to Make This Even More Awesome
There is one small dilemma here: the first person to run the report after it expires from the cache will be faced with the nasty, ugly, long-running report. Wouldn’t it be great if there was a way to expire and build the cache on a regular basis, so it was that fast every time?
It can be done! You need to set up a data-driven subscription, using the null delivery provider. The best part: I already wrote about that! http://jesborland.wordpress.com/2010/09/03/the-power-of-reporting-services-subscriptions-–-data-driven-subscriptions-–-null-delivery-provider/
Some Important Notes
A report won’t stay in the cache indefinitely. It will be removed if the report is set to expire, if the report is modified, if the parameters are modified, if the credentials of the data source change, if any other execution options change, or if you delete the report.
You can’t set up caching for a report that uses Windows authentication or one that prompts the user for credentials.
If your report has a parameter, every different parameter option that the report is run with will store another copy in the cache. Example: my report has a parameter of “Folder”. I have ten options – one for each department (Accounting, Marketing, etc.). If the report is run with “Accounting” selected, that will produce one copy in cache. If it is run two minutes later with “Marketing” selected, another copy will be stored in cache. Thus, if you have a report with a parameter that has a lot of options, and different options are frequently selected (for example, a customer drop-down with one hundred options), caching may not be an ideal solution for that report.
Tags: SSRS 2008