By: Scott Murray || Related Tips: > Reporting Services Administration
ProblemSQL Server Reporting Services offers several options for maintaining past executions of reports. Both the cache and snapshot history options were established in many prior versions and have only been made better with time. Surprisingly these options are somewhat unknown and used only sporadically and are often misunderstood. The two different methods also cause further confusion as some of the wording and the functionality is intermixed into both methods. So, what can I use SQL Server Reporting Services snapshots history and cache for?
SolutionBefore we go much farther, it probably would be great to explain the hierarchy of ways to save prior executions of reports. The first of history is the caching of a reports execution. Similar to the cache on you PC; this method stores recent execution(s) of your report. So, if you ran a sales report for the Georgia region covering last month, when enabled, SSRS would cache that report execution. Thus, if the cache has not changed (more later on how this happens), the next person running that same report for those same parameters, would retrieve the report from the SSRS cache. Please note this cache is different than what SQL Server is using for SQL Server itself. Snapshot history works in a similar but not the same way. A history snapshot is a specific point in time version of the report with specific parameters being set; many versions of the report can be saved in the snapshot history. In either case, both of these functions are designed to save your report users time when running reports especially those reports whose executions take a significant amount of time. Let us take a look how to implement each of these methods.
To get started you will first need to install Reporting Services if not already installed. You canuse this tip from Rajendra Gupta to assist with installing the latest version of reporting services. SQL Server Reporting Services 2017 can currently be downloaded from here . Be sure you are getting the latest edition and SSRS.
SQL Server Reporting Services Report CacheAs previously mentioned, a report cached works similar to the cache used by other computing functions. In essence, it stores a copy report data and report structure for later executions of the report. One thing it does not store is the rendering details which allows you to still benefit from report caching without being tied to a specific render format (such as pdf, Excel, etc.). To setup a report to use the cache, you must go to the report you would like to turn on caching. Next, you will want to manage the report by going to eclipse (3 dot) to the right of the report and then selecting Manage.
Image may be NSFW.
Clik here to view.

Next go to Caching Window for the report, as shown below.
Image may be NSFW.
Clik here to view.

On the Caching properties window, shown above, several alternative methods of expiring and refreshing the cache for the report exist. Of course, the default option for a report is to “Always run the report with the most recent data”, which I call the NO Cache option.
The second option is the pure caching option which allows us to actually set up a Cached copy of the report. When this option is selected, the subsequent execution of the report must use the same parameters in order for the cached copy of the report to be used. Furthermore, the cache expiration schedule is defined. Upon the cache expiration, the report will execute as if no cache copy existed (which will in turn create a new cached copied).
On the same cache properties window, we can define how often a cached version expires. The cache expiration time can either be defined in n number of minutes or on a specific defined individual schedule or a shared schedule (that a SSRS system administrator has defined).
Image may be NSFW.
Clik here to view.

Again, as soon as a report cache expires, the report will need to be “run again” to reload the cache for future users. So, for reports whose data only changes monthly, it may be beneficial to expire the report cache only once per month, for instance. Furthermore, not only can the expiration time frame be set for a report’s cache, but also a refresh plan can be established for a cached report. The plan creates a new cache which replaces the current cache version; a snapshot, discussed in the next section, can also be created as opposed to an individual cached report.
To initiate the Cache refresh plans, you will first need to click the apply button as shown below.
Image may be NSFW.
Clik here to view.

Upon clicking Apply, the Manage Refresh Plan link appears.
Image may be NSFW.
Clik here to view.

From this window, a new cache refresh plan can be added, a new plan can be created by copying an old plan, a plan can be deleted, and finally, the plan as a whole can be Refreshed now.
Image may be NSFW.
Clik here to view.

As illustrated next, the refresh plan must be named, a schedule, either shared or specific to the report, is selected (or created), and finally, the default parameters or user selected values are selected. Be sure the cache expiration time frame does interfere with the refresh schedule (for example, the cache expiration time expires every night at midnight while the cache refresh schedule runs daily at 11.45pm. That sort of schedule would defeat the purpose of having the refresh plan).
Image may be NSFW.
Clik here to view.

As shown below, the refresh plan is now running at 02:00.
Image may be NSFW.
Clik here to view.

SQL Server Reporting Services Snapshots
Whereas caching a report is done somewhat automatically, snapshots require more setup, but also provide additional flexibility. Snapshots are established in the same area as caching. Just click on the three dots to the right of the report name and the select Manage. Next you will want to select the Schedule and settings option.
Image may be NSFW.
Clik here to view.

The first setting to be set is whether to create the history snapshot, and if yes, then on either a shared or individualized schedule. Under the advanced options, we must specify how many copies of the snapshot should be retained. Either the system default values, a n number of snapshots, or retain all options can be selected. The last option provides a way for saving the cache history into the report history.
Image may be NSFW.
Clik here to view.

Subsequently, we could go ahead and select the New history snapshot option.
Image may be NSFW.
Clik here to view.

Upon clicking the New history snapshot button, an actual snapshot is created. You will notice in the below screen print, I created three report snapshots. In thinking through this process, please note these historical snapshots are generally accessed by navigating to the History Snapshots window.
Image may be NSFW.
Clik here to view.
