Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

SQL Server Sniffing Issues

$
0
0

Hi,

I have a specific performance issue that I am trying to diagnose, I noticed that update statistics is frequently run on a database, and I want to just rebuild the indexes only and not manually run update stats on an ad-hoc basis and also understand the root cause of the problem.

Here is the scenario, I rebuilt all the indexes on a database and then run the stored procedure, what I found was that the stored procedure was stuck on a particular query for over 6 hours and never completed, I had to manually end it. Before running the stored procedure, I  also cleared the procedure cache.

When I looked at the stored procedure which became stuck, I looked at the procedure cache and then realised that some of the parameters were sniffed by the stored procedures, as I could see values in there. I stopped the stored procedure manually in this case.

At the second attempt I rebuilt the indexes again, cleared the proc cache and included the WITH RECOMPILE hint at the parent stored procedure. The procedure ran and it took 2.5 hours this time around. The reason for this is that I want to ascertain why the stored procedure cannot work with full scan sampling which is what you get with index rebuilds.

At the third attempt, I did the following, I then ran sp_updatestatistics on the database, cleared the procedure cache and then kicked off the stored procedure, this time it compelted within 45 minutes which is the usual time that it should take.


Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>