Database Reference
In-Depth Information
To filter the information returned from sys.dm_exec_query_stats, you'll need to join it with other dynamic
management functions such as sys.dm_exec_sql_text, which shows the query text associated with the plan, or sys.
dm_query_plan, which has the execution plan for the query. Once joined to these other DMOs, you can filter on the
database or procedure that you want to see. These other DMOs are covered in detail in other chapters of the topic. I'll
show examples of using sys.dm_exec_query_stats and the others, in combination, throughout the rest of the topic. Just
remember that these queries are cache dependent. As a given execution plan ages out of the cache, this information
will be lost.
Summary
In this chapter, you saw that you can use Extended Events to identify the queries causing a high amount of stress on
the system resources in a SQL workload. Collecting the session data can, and should be, automated using system
stored procedures. For immediate access to statistics about running queries, use the DMV sys.dm_exec_query_stats.
Now that you have a mechanism for gathering metrics on queries that have been running against your system,
in the next chapter you'll explore how to gather information about a query as it runs so that you don't have to resort to
these measurement tools each time you run a query.
 
Search WWH ::




Custom Search