patternsqlMinor
What are the practical impacts of the sys.dm_exec_query_stats warning in the documentation?
Viewed 0 times
thewhataredocumentationsysimpactspracticalwarningdm_exec_query_stats
Problem
The documentation for
An initial query of sys.dm_exec_query_stats might produce inaccurate
results if there is a workload currently executing on the server. More
accurate results may be determined by rerunning the query.
I sometimes query that DMV during an active workload and would prefer accurate results. I do not know how to apply the above warning in practice. Should I always query the DMV twice and use the second result set because that will be more accurate? That feels a bit far-fetched. Do I need to be aware of the ways in which the DMV can be inaccurate so I can factor that into my analysis? If so, what kind of inaccuracies can appear: missing rows, outdated values, inconsistent rows, or something else?
What are best practices when using
sys.dm_exec_query_stats states the following:An initial query of sys.dm_exec_query_stats might produce inaccurate
results if there is a workload currently executing on the server. More
accurate results may be determined by rerunning the query.
I sometimes query that DMV during an active workload and would prefer accurate results. I do not know how to apply the above warning in practice. Should I always query the DMV twice and use the second result set because that will be more accurate? That feels a bit far-fetched. Do I need to be aware of the ways in which the DMV can be inaccurate so I can factor that into my analysis? If so, what kind of inaccuracies can appear: missing rows, outdated values, inconsistent rows, or something else?
What are best practices when using
sys.dm_exec_query_stats during an active workload?Solution
I've updated the documentation to be more straight-forward on the wording. The intent was to tell the user that running a query against the DMV will produce output only for items that had completed and not for items in-flight. Thus, run the workload in its entirety to make sure all is captured.
The new wording will be the following and applied the various DMVs the previous wording was incorporated into.
The results of sys.dm_exec_query_stats may vary with each execution
as the data only reflects finished queries, and not ones still
in-flight.
The new wording will be the following and applied the various DMVs the previous wording was incorporated into.
The results of sys.dm_exec_query_stats may vary with each execution
as the data only reflects finished queries, and not ones still
in-flight.
Context
StackExchange Database Administrators Q#240540, answer score: 7
Revisions (0)
No revisions yet.