Statement to calculate hit ratio

  • Hello I'm quite new in sql-server, does anybody knows a way to calculate memory hit ratio in sql server, just by a sql or T-SQL statement?


    @Base FLOAT


    @Base = (SELECT cntr_value FROM sys.dm_os_performance_counters

    WHERE object_name = 'SQLServer:Buffer Manager'

    AND counter_name = 'Buffer cache hit ratio base')



    p1.object_name, p1.counter_name, p1.instance_name, RTRIM(p1.cntr_value / @Base) as 'Percent'


    sys.dm_os_performance_counters p1 WHERE p1.counter_name = 'Buffer cache hit ratio' and p1.object_name = 'SQLServer:Buffer Manager'


    That will give you the percent for your Buffer Cache hit ratio...basically the Buffer cache hit ratio is divided by it's base to get the percentage. 

    Christopher Ford

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply