Solved

what determines how much of cached queries are stored in DMVs

Posted on 2012-04-12
1
216 Views
Last Modified: 2012-06-27
what are the factors (other than how many GB of physical memory is allotted to SQL server) that influence how old info this query can bring back:

select *
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt
CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp
0
Comment
Question by:25112
1 Comment
 
LVL 40

Accepted Solution

by:
lcohan earned 500 total points
ID: 37840062
I believe besides that you need to look at Last SQL Server restart and Max/Min memory settings in SQL to determine oldest entry available via DVMs.
Also if a sp_recompile or a huge query flushed the plan(s) from cache then its also posible to not be retrieved by above query:

ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/eb7b58b8-3508-4114-97c2-d877bcb12964.htm

"Returns aggregate performance statistics for cached query plans. The view contains one row per query statement within the cached plan, and the lifetime of the rows are tied to the plan itself. When a plan is removed from the cache, the corresponding rows are eliminated from this view."
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How can i use WITH CTE for checking exist value? 3 47
sql 2014,  lock limit 5 39
Help Required 3 110
domain login has permission in database, but gets error 3 18
Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question