So a little while back we noticed that we had some high CPU load coming from a single stored procedure in the Session State database. This single procedure (TempUpdateStateItemLong) was taking up 80% of the CPU time that the database was using (we used Spotlight for SQL Server Enterprise from Quest software). But in another session state database that same procedure was down in the single digits. So something must be different between them.
I opened them both up in SSMS and the code for the procedures was identical (as you would expect), but there was something different. The procedure that had the really high CPU % times was compiled with the SET QUOTED_IDENTIFIER ON setting, while the procedure that had the really low CPU % times was compiled with the SET QUOTED_IDENTIFIER OFF setting.
I have no idea why there was a difference, but I changed the one which was ON to OFF and pushed the procedure into the database. As soon as I did the CPU % for that procedure dropped down into the single digit range where it should have been.
Let this be a lesson, those setting definitely matter. And don’t trust that they are correct, even in Microsoft provided code like Session State.
DennyContact the Author | Contact DCAC