さまざまな方法でキャッシュを照会することができます。内容を調べたり、関連する統計を調べたりできます。
あなたの道に沿ってあなたを助けるためのコマンドのカップル:
SELECT * FROM syscacheobjects -- shows the contents of the procedure
-- cache for all databases
DBCC PROCCACHE -- shows some general cache statistics
DBCC CACHESTATS -- shows the usage statistics for the cache, things like hit ratio
あなただけの1のデータベースのキャッシュをクリアする必要がある場合は、あなたが使用することができます。
DBCC FLUSHPROCINDB (@dbid) -- that's an int, not the name of it.
-- The int you'd get from sysdatabases or the dbid() function
編集:その行の上にあるのは2000年のことです。これは質問が尋ねたものです。
select * from sys.dm_exec_cached_plans -- shows the basic cache stuff
2005年に計画を示すための便利なクエリ::私はどのように把握することができますどのように
SELECT cacheobjtype, objtype, usecounts, refcounts, text
from sys.dm_exec_cached_plans p
join sys.dm_exec_query_stats s on p.plan_handle = s.plan_handle
cross apply sys.dm_exec_sql_text(s.sql_handle)
しかし、誰もがSQL Server 2005のを使っている人の訪問のために、それは、上記に若干異なる配置です現在、ストアドプロシージャの多くの計画が存在しますか? – Jon
SELECT objType、sql、* syscacheobjectsからsqlのように 'yourproc%' –
ありがとう。あまりにも多くのコラムがありますが、当初は明らかではありませんでした。 – Jon