SQLServerCentral Article

Cache Snapshots And History Snapshots in SSRS 2016

,

While taking training classes for national and international students, I have often seen the students getting confused with the way snapshot options work in Reporting Services (SSRS) 2016. I decided to write this article to help explain the options.

The first thing to understand here is what is a snapshot? As the name suggests, this is just like a picture, A snapshot is a picture of the data at that given moment. Once you click a snapshot, the picture stays that way and doesn’t change. You can create a new one, which could replace the first. This is the same in SSRS. Aa snapshot stores the data of a report at a given moment. After understanding what a snapshot is, let’s now explore the snapshot options in SSRS 2016.

There are actually two options in SSRS related to snapshots: The first option is to always run a report from a snapshot. What this means is that your report will always pull data from a predefined snapshot. The below image shows this option:

Here I have selected the RedBushSalesReport to be run from a snapshot. You may also choose the option “Create a cache snapshot when I click Apply on this page”. This will create the snapshot immediately after you click the Apply button. From this point onwards, your report will always pull data from this snapshot. If the data changes in database, you will still keep getting the same data.

Also note that if the report has any parameters, then you need to specify a default value for them to generate the snapshot as shown below. In htis image, I have chosen the default date value of July 15, 2007.

If you don’t specify default values for parameters, then you will get this error:

If you run/refresh multiple times, you will see the report returnd same data. Notice that you will not be allowed to change the parameter value now. Since the report is supposed to come from a snapshot, which has a default parameter, you will only be able to run it with that default parameter(s). I refreshed the RedBushSalesReport multiple times, and every time it displayed the same execution time, which confirms that the data is coming from a static snapshot. The parameter value is set at the top and cannot be changed.

Sometimes you may have a requirement to run a report with fixed parameters on a daily basis. If the report is resource intensive and takes time to generate, you may choose to schedule the snapshot. One option is to schedule this before the office opens, which will allow everybody to run the report quickly. Your boss will be happy to see this performance.

Depending upon how long you can afford to show stale data, you can schedule the snapshot to repeat within this period. The image belowshows the scheduling of a snapshot at the same time every day.

Notice that whenever you are generating snapshots using any of the above two options, by default no history of these snapshots is maintained. You can check this by clicking the “History Snapshots” option.

Now let’s see what History snapshots are. The main purpose of a Report History snapshot is to keep a copy of the report at a specific point of time. If you want to keep track of how your report looked at different points of time, you can generate the History Snapshots by clicking the “New History Snapshot” button as shown below:

If I click the “View History Snapshot” button, I will see the report with this new snapshot. What will happen if run the report normally by going back to “Browse”? Will I see the report with this snapshot or the older snapshot that we generated? We will see the report with older snapshot only. So that means your report doesn’t pull data from history snapshots. They are just used to keep a trail of how your report looks at specific times.

Can I keep a history of snapshots that I generate from the Caching tab? Yes, you can. From History snapshots tab, go to the Schedule and Settings option, as shown below:

Using this option, you can specify how to save snapshots in History. You can also specify how many history snapshots you want to retain. Additionally you can generate the History snapshots on a predefined schedule. All these options are shown below.

You must have noticed that there can be only one report execution snapshot at a time, but there can be many History snapshots. I hope this clarifies the difference between History snapshots and report execution cached snapshots. If you have any questions, I’ll be happy to respond in the discussion forum of this article.

Rate

3.6 (5)

You rated this post out of 5. Change rating

Share

Share

Rate

3.6 (5)

You rated this post out of 5. Change rating