规划SQL Server EXPRESS的缓存大小。

时间:2014-03-18 22:33:24

标签: sql-server-2008

我在某些服务器上使用SQL EXPRESS。内存限制为1.5GB。如何在SQL Express中找到EACH数据库的计划缓存大小?

1 个答案:

答案 0 :(得分:1)

因为没有人回答......

SELECT SUM(size_in_bytes) * 1.0 / POWER(1024, 2) PlanCacheSize FROM sys.dm_exec_cached_plans;
go 

SELECT objtype AS [CacheType]
        , count_big(*) AS [Total Plans]
        , sum(cast(size_in_bytes as decimal(18,2)))/1024/1024 AS [Total MBs]
        , avg(usecounts) AS [Avg Use Count]
        , sum(cast((CASE WHEN usecounts = 1 THEN size_in_bytes ELSE 0 END) as decimal(18,2)))/1024/1024 AS [Total MBs - USE Count 1]
        , sum(CASE WHEN usecounts = 1 THEN 1 ELSE 0 END) AS [Total Plans - USE Count 1]
FROM sys.dm_exec_cached_plans
GROUP BY objtype
ORDER BY [Total MBs - USE Count 1] DESC
go