Fast query runs slow in SSRS

前端 未结 17 924
粉色の甜心
粉色の甜心 2020-11-28 23:53

I have an SSRS report that calls out to a stored procedure. If I run the stored procedure directly from a query window, it will return in under 2 seconds. However, the sam

相关标签:
17条回答
  • 2020-11-29 00:44

    Thanks for the suggestions provided here. We have found a solution and it did turn out to be related to the parameters. SQL Server was producing a convoluted execution plan when executed from the SSRS report due to 'parameter sniffing'. The workaround was to declare variables inside of the stored procedure and assign the incoming parameters to the variables. Then the query used the variables rather than the parameters. This caused the query to perform consistently whether called from SQL Server Manager or through the SSRS report.

    0 讨论(0)
  • 2020-11-29 00:44

    Aside from the parameter-sniffing issue, I've found that SSRS is generally slower at client side processing than (in my case) Crystal reports. The SSRS engine just doesn't seem as capable when it has a lot of rows to locally filter or aggregate. Granted, these are result set design problems which can frequently be addressed (though not always if the details are required for drilldown) but the more um...mature...reporting engine is more forgiving.

    0 讨论(0)
  • 2020-11-29 00:46

    If your stored procedure uses linked servers or openquery, they may run quickly by themselves but take a long time to render in SSRS. Some general suggestions:

    • Retrieve the data directly from the server where the data is stored by using a different data source instead of using the linked server to retrieve the data.
    • Load the data from the remote server to a local table prior to executing the report, keeping the report query simple.
    • Use a table variable to first retrieve the data from the remote server and then join with your local tables instead of directly returning a join with a linked server.

    I see that the question has been answered, I'm just adding this in case someone has this same issue.

    0 讨论(0)
  • 2020-11-29 00:47

    I simply deselected 'Repeat header columns on each page' within the Tablix Properties.

    0 讨论(0)
  • 2020-11-29 00:49

    I was able to solve this by removing the [&TotalPages] builtin field from the bottom. The time when down from minutes to less than a second.

    Something odd that I could not determined was having impact on the calculation of total pages.

    I was using SSRS 2012.

    0 讨论(0)
提交回复
热议问题