开发者

Does MS SQL Server 2008 cache binary data fields? Ie VARBINARY

开发者 https://www.devze.com 2023-02-16 01:31 出处:网络
Does MS SQL Server 2008 cache binary data fields? Ie VARBINARY We have MS SQL Server 2008 R2 using 12gb of ram constantly caching data. Our database includes over 200gb of VARBINARY. Would this be ca

Does MS SQL Server 2008 cache binary data fields? Ie VARBINARY

We have MS SQL Server 2008 R2 using 12gb of ram constantly caching data. Our database includes over 200gb of VARBINARY. Would this be cached as well?

EDIT: 开发者_JAVA百科SQL Server does indeed cache binary data Thanks @Martin

Can you tell SQL Server to stop caching binary data or to limit this somehow?


Yes. Try

WITH T
     AS (SELECT database_id,
                page_type,
                total_page_count = COUNT(*) OVER (),
                page_count = COUNT(*) OVER 
                                     (PARTITION BY database_id, page_type),
                row_num = ROW_NUMBER() OVER 
                                     (PARTITION BY database_id, page_type 
                                          ORDER BY (SELECT 0))
         FROM   sys.dm_os_buffer_descriptors)
SELECT page_type,
       page_count,
       PercentageOfCache = ROUND(1E2 * page_count / total_page_count, 2),
       SizeInCache =
       CASE
         WHEN page_count > 131072 
              THEN LTRIM(STR(page_count / 131072.0) + ' GB')
         WHEN page_count > 128 
              THEN LTRIM(STR(page_count / 128.0) + ' MB')
         ELSE LTRIM(STR(page_count * 8) + ' KB')
       END
FROM   T
WHERE  database_id = DB_ID()
       AND row_num = 1
ORDER  BY page_count DESC  

To see how many of each type of page are currently in the buffer cache for your database.

Dedicated LOB page types are TEXT_MIX_PAGE and TEXT_TREE_PAGE but LOB data can also be stored on data pages.

0

精彩评论

暂无评论...
验证码 换一张
取 消