The postings on this site are my own and do not represent my Employer's positions, advice or strategies.

LifeAsBob - Blog

 

Home

No Ads ever, except search!
Monday, March 18, 2024 Login
Public

SQL Server negative usecounts in procedure cache 1/29/2018 9:06:33 AM

I track stored procedure counts and plans for reporting on volume, when a plan changes and data mining the plans for missing indexes and other information.


The trick to this is you have to track it over time as the DMV tracks cumulative count. An issue I ran into recently was that the cumulative count was negative. I don't know and found a few links, but no real explanation. So now when I find a negative count I usually mark it for removal from the query cache so that it resets. I'm guessing that the count reached the maximum value and "rolled" over to a negative values (similar to reseeding an identity to a negative value when the maximum value of an integer data type has been reached).
https://social.technet.microsoft.com/Forums/en-US/abd274a7-5a6d-487c-a1df-01fb10e5b84b/dmexecrequests-showing-a-negative-value-in-the-logical-reads-column?forum=sqldatabaseengine
and
https://social.technet.microsoft.com/Forums/en-US/abd274a7-5a6d-487c-a1df-01fb10e5b84b/dmexecrequests-showing-a-negative-value-in-the-logical-reads-column?forum=sqldatabaseengine


Blog Home