1. 程式人生 > 資料庫 >SQL Server 計劃快取那些事兒

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)

摘要: