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
简短的回答是:不是,因为如果您检查缓存中有哪些执行计划,这些是您可以在那里找到的对象:
cacheobjtype nvarchar(34) 缓存中的对象类型。该值可以是以下之一:
编制计划
编译计划存根
解析树
扩展过程
CLR 编译函数
CLR 编译过程
您可能正在考虑考虑:
针对临时工作负载规划缓存和优化
检查您的计划缓存是由什么组成的:
使用优化即席工作负载配置选项最大限度地减少计划缓存膨胀
我想提的另一件事是..
高编译(不重新编译):
高编译和多语句表值函数