SQL Server 计划缓存那些事儿

查询计划缓存内容

SELECT qs.plan_handle, a.attrlist,*
FROM   sys.dm_exec_query_stats qs
CROSS  APPLY sys.dm_exec_sql_text(qs.sql_handle) est
CROSS  APPLY (SELECT epa.attribute + '=' + convert(nvarchar(127), epa.value) + '   '
              FROM   sys.dm_exec_plan_attributes(qs.plan_handle) epa
              WHERE  epa.is_cache_key = 1
              ORDER  BY epa.attribute
              FOR    XML PATH('')) AS a(attrlist)
WHERE  est.text LIKE '%WHERE OrderDate > @orderdate%'
  AND  est.text NOT LIKE '%sys.dm_exec_plan_attributes%'
如何清除特定语句的执行计划缓存?
DBCC FREEPROCCACHE(0x060001002903DC0B4001B887000000000000000000000000)

摘要:https://blog.51cto.com/ultrasql/1626692

理解性能的奥秘——应用程序中慢,SSMS中快(6)——SQL Server如何编译动态SQL

T-SQL动态查询(4)——动态SQL

上一篇:装饰器Decorator


下一篇:Terraform学习总结(1)——Terraform 简介