计算服务器中cache plan的大小1

 

可以使用性能计数器,

\sqlserver:plan cache(temporary tables & table variables)\cache pages

\sqlserver:plan cache(extended stored procedures)\cache pages

\sqlserver:plan cache(bound trees)\cache pages

\sqlserver:plan cache(sql plans)\cache pages

\sqlserver:plan cache(object plans)\cache pages

\sqlserver:plan cache(_total)\cache pages

 

也可以使用t-sql

查看服务器中存储过程和adhoc,autoparameterized prepared plan的比例,大小

select name,type,single_pages_kb, multi_pages_kb,(single_pages_kb+multi_pages_kb)/1024 as total_sizeMB, entries_count

from sys.dm_os_memory_cache_counters

where type in ('cachestore_objcp','cachestore_sqlcp')

--where type in ('cachestore_objcp','cachestore_sqlcp','cachestore_phdr','cachestore_xproc')

 

 

从下面这个图中可以看出,服务器中sp使用比例极少

 

 

select type,count(*) from sys.dm_os_memory_cache_entries

where type in ('cachestore_objcp','cachestore_sqlcp')

group by type

 

Plan Caching in SQL Server 2008

posted on 2010-10-20 23:43  stswordman  阅读(561)  评论(2编辑  收藏  举报