9990的“缓冲区高速缓存命中率”是什么意思?


12

我从博客文章中得到了这个查询:

SELECT object_name, counter_name, cntr_value
FROM sys.dm_os_performance_counters
WHERE [object_name] LIKE '%Buffer Manager%'
AND [counter_name] = 'Buffer cache hit ratio'

该帖子说,这将使我对缓存的命中率有所提高。似乎表明它将是0-100的值(结果显示为87)。

但是当我运行它时,我得到的数字很高。这是一个例子:

object_name               counter_name             cntr_value  
SQLServer:Buffer Manager  Buffer cache hit ratio   9990

这是否意味着99.90%?

如果没有,那是什么意思?我如何获得真正的价值?

注意:我得到的值低至257和高至352363

如果相关,则还有其他一些服务器统计信息:

  • 网页预期寿命:145
  • 页面每秒读取数:1,380,009,009

1
抱歉,博客文章有误。:-( Denis Gobo正确了 ...
Aaron Bertrand

Answers:


18

令人困惑,对不对?

好吧,其实得到的比例,你需要自己使用做Buffer cache hit ratio base除了Buffer cache hit ratio采取从结果Buffer cache hit ratio / Buffer cache hit ratio base

请尝试以下查询(来自Less Than Dot),该查询应为您提供所需的百分比:

SELECT (a.cntr_value * 1.0 / b.cntr_value) * 100.0 as BufferCacheHitRatio
FROM sys.dm_os_performance_counters  a
JOIN  (SELECT cntr_value, OBJECT_NAME 
    FROM sys.dm_os_performance_counters  
    WHERE counter_name = 'Buffer cache hit ratio base'
        AND OBJECT_NAME = 'SQLServer:Buffer Manager') b ON  a.OBJECT_NAME = b.OBJECT_NAME
WHERE a.counter_name = 'Buffer cache hit ratio'
AND a.OBJECT_NAME = 'SQLServer:Buffer Manager'

5
您应该相信Denis Gobo ...
Aaron Bertrand

@Aaron其中的一个日子-归属添加
LowlyDBA

我对得到的结果感到困惑,请参阅相关信息如何在PLE为103的情况下使缓冲区高速缓存命中率达到100%?
James Jenkins

0

如果您没有SQL Server的默认实例,而是命名实例,则必须像这样修改查询:

  SELECT (a.cntr_value * 1.0 / b.cntr_value) * 100.0 as BufferCacheHitRatio
FROM sys.dm_os_performance_counters  a
JOIN  (SELECT cntr_value, OBJECT_NAME 
    FROM sys.dm_os_performance_counters  
    WHERE counter_name = 'Buffer cache hit ratio base'
        AND OBJECT_NAME LIKE '%:Buffer Manager%') b ON  a.OBJECT_NAME = b.OBJECT_NAME
WHERE a.counter_name = 'Buffer cache hit ratio'
AND a.OBJECT_NAME LIKE '%:Buffer Manager%'
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.