SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in


When you undertake some performance improvement task, you think it is frustrating however at the same time you tend to learn more. So the other day we had to brain storm on one of the similar issues where the database stored procedure was returning data quickly as compared to the SSRS report (using same stored procedure) which seemed to be taking ages to run and display data. 

The initial investigation and their results were:-
  1. Finding out from excutionlog table where the issue is. Turned out that 'TimeDataRetrieval' was considerably high for previous runs of the report. This proved that the real cause was indeed the slow performance of the stored procedure.
  2. Checked to see whether it could be related to temp database. On connecting with the database admin this was ruled out.
  3. Checked to see the cpu utilization at the report server. Nothing significant was found.
After doing all these steps,  I thought that this issue might be related to the parameter sniffing. Parameter sniffing in short is when a particular query with input parameters takes more time to execute because it is using the execution plan of the any of the previous run of the same query with different parameter values. So we recompiled the stored procedure and this did the trick and got us back on track as far as performance of Report is concerned.

You can find a detailed informative article on PARAMETER SNIFFING here:-

I would like to know your comments on the following questions :
1. What would confirm  that the issue was only because of parameter sniffing?
2. If it was due to PS, why would we encounter the issue on running the report only and not by running the stored procedure?



My name is Lokesh Sharma, I have 5 years of experience working with SQL and am really interested in exploring more and more about this fascinating language. My aim here is to share some of the challenges that I faced while working with SQL and also to get feedback whether the approach I followed is an optimal one or not.


Leave a comment on the original post [itchallengesdaily.blogspot.com, opens in a new window]

Loading comments...