Troubleshooting Report Performance
New: 17 November 2008
This topic describes ways that you can help improve report performance.
To troubleshoot report performance, use Reporting Services log files to determine where most of the time is being spent: in retrieving data, in processing the report layout, or in rendering the report. For more information, see Troubleshooting Techniques for Report Problems.
After you determine where the most time is being spent, use the following sections to help troubleshoot specific issues.
Improving Data Retrieval Performance
Improving Report Processing Performance
Improving Report Rendering Performance
Improving Data Retrieval Performance
More report data uses more resources and more storage, creates more network traffic, and requires more processing time. To help control report performance, design reports that have reasonable amounts of data and complexity. For example, few users want to view a 1,000-page report. Users have difficulty keeping context for a drilldown report if the a table has too many levels of nesting or difficulty scanning a table with too many columns. Pie charts that have hundreds of slices look cluttered and are difficult to read. Analyze your report requirements carefully to determine how much data you need, and then retrieve only that data from the report data sources.
Use the information in the following sections to help reduce the time that is spent retrieving data for your report.
Retrieving More Data Than You Need
It is more efficient to filter, sort, and aggregate large amounts of data on the data source than during report processing. Write queries to return only the data that you want to show in a report. If you plan to display only summary data, calculate aggregates on the data source and do not retrieve detail data. The following list suggests ideas for evaluating each report query in the report:
- Write queries with WHERE clauses or HAVING clauses that limit the data to just what the user must see in the report. Use query parameters to restrict data that is retrieved at run time. For more information, see Filtering Rows by Using WHERE and HAVING.
When you create a snapshot report that has report parameters that filter the data, all possible data that could be displayed in the report must be saved in the snapshot. In this case, do not use query parameters in the dataset queries. Instead, manually create report parameters that you can use in filter expressions to enable the user to specify the report data they want.
- Write queries with the ORDER BY clause to presort data that is retrieved for a report. Sort the data in the order you want it sorted in the report. Presorted data improves report processing time because of the way it is stored in memory. Many report processing tasks do not require sorting data before processing it. For example, SUM is not dependent on sort order. Data within group instances is not automatically sorted. If you do not need sorted data in the report, do not set sort expressions on the dataset or data region. For more information, see ORDER BY Clause (Transact-SQL) and Sorting Data in a Report.
Sorting groups or sorting by aggregate values, however, is simpler in the report than in the query. Frequently, sorting groups in the report is more efficient than sorting groups in the query.
- Write queries with GROUP BY to aggregate values on the data source.
Many times, the most effective way to communicate information is by aggregating values and displaying summaries. You can calculate some level of aggregates on the data source and retrieve them for a dataset. The "detail" data in the dataset now represents aggregates calculated on the data source. For more information about aggregating in the query, see Summarizing Query Results (Visual Database Tools).
After these pre-aggregated values are in a report, you can continue to aggregate the values as long as you are using an aggregate function that is mathematically transitive, for example, SUM. For example, assume that you have a set of 6 values: 1, 2, 3, 4, 5, 6. If you group the values into pairs, you have a set of 3 values: 3, 7, 11. You can calculate the sum on the first set (21) and calculate the sum of the second set (21) and the sums are the same regardless of the grouping. If you average the values in the sets by using the AVG function, you get a different result for each set. The average for the set of 6 is 21/6 or 3.5. The average of the set of 3 is 21/3 or 7. AVG is not a transitive function.
- Consider analyzing and optimizing the query performance on the data source. For example, to learn about the query optimizer for SQL Server 2005, see Query Performance and Single SQL Statement Processing.
- Consider the amount of data needed for a chart. In a line chart, drawing hundreds of points in a few pixels on a monitor degrades performance and does not enhance the visual display of the graphics. In a pie chart, more than 7 or 8 slices is of questionable value.
- For report items with conditional visibility, the report processor must apply grouping, sorting, and filtering expressions even if only the top level of data is at first visible. If the user is only interested in seeing detail data some of the time, a drillthrough report is a better choice. Drillthrough reports do not run until a user clicks the drillthrough link in the main report. Drilldown reports or subreports process all data even when the data is first hidden. For more information, see Adding Links to a Report.
- Consider creating execution snapshots for a report. A report snapshot includes all report data retrieved for the datasets in the report definition. For more information, see Report Snapshots.
Large Amounts of Network Traffic Cause Longer Wait Times
Large amounts of data passed as network traffic can introduce wait times for the user. If you know the expected user base and the expected volume of report views, you can select the appropriate approach for deploying report server components.
Consider the following strategies to help reduce wait times for the user:
- Keep the report server database on the same computer as the report server.
The report server database tempdb manages report data that is retrieved for each dataset query. Keep tempdb on the report server to reduce network traffic that can slow report execution.
- For data warehouse data sources, keep the data warehouse on a separate server than the report server.
Although retrieving data across the network does add an extra task for report execution, having both the data warehouse and Reporting Services on the same server can slow performance because they both contend for memory.
For more information, see Planning a Reporting Services Deployment.
Query Timing Out
If a dataset query times out before it can retrieve data, you can specify a time-out value in the report. By default, this value is set to 30 seconds. To set the time-out value for a dataset query, see How to: Create a Dataset (Report Designer). For more information, see Setting Time-out Values for Report Execution.
Improving Report Processing Performance
Report processing occurs after the data is retrieved for report datasets and report parameters. The report processor combines the report layout and the data to create an interim report format that is then passed to the report renderer. Report processing time can be affected by report layout, paging, and complex expressions in report items that have many instances. Use this section to help improve report processing performance.
Choosing the Right Data Region
Use table and list data regions when possible. Processing a table or list is more efficient than processing a matrix. Table and list data regions support dynamic elements for rows only; matrix layouts support dynamic elements for both rows and columns, which creates a more complex layout structure.
Avoid Total Pages Value in the Page Header or Footer for Physical Page Renderers
A reference to the global field TotalPages can affect report processing performance when the report is rendered by a layout rendering extension that paginates for physical pages, for example, PDF or Image. For more information about renderers, see Design Considerations for Report Rendering.
Using Complex Data Region Grouping and Aggregate Functions
Many levels of nested groups in a table or matrix data region can affect report processing performance. Consider both the level of grouping, the number of group instances, and the use of aggregate functions which require evaluating after group, filter, and sort expressions are applied.
Avoid post-sort aggregates. Post-sort aggregates depend on sort order and include the following functions: Previous, First, Last, and RunningValue. When you include one or more of these functions in an expression, the report processor must sort the target data before applying the function. Where possible, avoid including post-sort aggregates in expressions in matrix layouts that have complex group definitions, such as multiple nested or adjacent groups.
Evaluate the report design and consider whether some data aggregation can occur on the data source. Reducing the amount of data in the report might be sufficient to provide acceptable performance without changing any aggregate function calls.
For more information about aggregate functions, see Using Report Functions in Expressions (Reporting Services).
Specifying Unnecessary Recursion in Expressions
Specify a parent expression for a group only if you are defining a recursive hierarchy, for example, an organizational report that displays managers and employees. The Parent property applies only to recursive data. The Parent property specifically does not apply to the parent-child relationship of nested groups.
Using Subreports in a Data Region with Many Rows
Understand the advantages and disadvantages of using subreports. Each subreport instance is a separate query execution and a separate report processing task.
- Use subreports in a data region when there are just a few subreport instances.
- Avoid subreports in a data region group when there are many group instances. For example, to display a list of both sales and returns for each customer, consider using drillthrough reports. Consider whether you can write the query to join the customer data with sales and returns data and then group by the customer ID.
- Do use subreports when the subreport uses a different data source than the main report. If performance is an issue, consider changing the dataset query in the main report by using one of the following strategies:
- Collect data in a data warehouse and use the data warehouse as a data source for a single dataset.
- Use SQL Server linked servers and write a query that retrieves data from multiple databases.
- Use the OPEN ROWSET capability to specify different databases.
Using Interactive Sort
Avoid interactive sort buttons unless users require the ability to change the sort order of data in the report.
Understand the resource requirements for images.
- Avoid large images including background images. Large images require memory, processing, and rendering resources, especially when they are rendered to hard-copy renderers such as PDF, print, or document images.
- Avoid many instances of small images from a database or on a server, for example, key performance indicators (KPIs). Include these images as embedded images in the report.
- For reports that have many images, set AutoSize on images to a different value such as Fit.
Processes Competing for the Same Memory on the Report Server
Multiple applications that compete for the same memory resources on a report server can affect report processing.
Work with the system administrator to verify that the memory management configuration is the correct model for your report server use. For more information, see Configuring Available Memory for Reporting Services.
Report Execution Times Out
In order to run large reports, there are two time-outs you must adjust: report execution time-out and the ASP.NET time-out.
Report execution time-out values are specified on the report server. For more information, see Setting Time-out Values for Report Execution.
ASP.NET time-out policy is controlled by the report server configuration file. The default location for this file is <drive>:\Program Files\Microsoft SQL Server\MSSQL.n\Reporting Services\ReportServer\web.config. To set the maximum number of seconds a request can execute, set the httpRuntime element to the time-out value in seconds. The following XML fragment shows where to add this element in the configuration file:
<configuration> . . . <system.web> . . . <httpRuntime executionTimeout="90"/> . . . </system.web> . . . </configuration>
For long-running queries or complex reports, you might need to specify a value that represents several hours.
Improving Report Rendering Performance
Report rendering occurs after data and layout are combined and passed to a rendering extension. Rendering time depends on the amount of data, the number of instances of report items, and page sizes. A report renderer determines how much data fits on a page. The definition of a page differs among renderers. A page for the Excel renderer is a worksheet. A page for the PDF renderer, which can print a report, is the physical page. A page for the HTML viewer can be the whole report. Report design for a printed page can differ from report design for online viewing. If you expect that your users will view a report in a specific format, design the report for that format. For more information, see Design Considerations for Report Rendering.
The following table suggests ways to help improve report rendering performance.
If you have trouble rendering a report in one format, select a format that produces a smaller file, for example, CSV. For a published report, you can specify a rendering format in the URL. For more information, see Specifying a Rendering Format in a URL.
If you cannot select another format because the report toolbar is not available, you can define a subscription to set a rendering format and deliver the report as a static document to a file share. For more information, see File Share Delivery in Reporting Services.