October 19, 2021 at 2:46 pm
Dear friends,
I have a custom performance monitor based on snapshotting sys.dm_exec_query_stats, and now I noticed that once upon a time I'm getting something which looks like a reset or overflow for the total_elapsed_time column.
Actually I found this behavior in 2 MSSQL instances, and there is one more weird thing:
Moreover, I would not expect the reset threshold to change across MSSQL versions (and especially not to go down).
Is this a known issue / expected?
Is there any documentation for that (especially which column has which reset threshold for different MSSQL versions)?
Thanks in advance.
October 20, 2021 at 11:52 am
It's probably just evidence of a given query exiting cache for whatever reason it exited cache. All the execution DMVs are cache dependent. Any given query that leaves cache, for any length of time, resets all counters to zero. So, all the rules around aging out of cache are in play, as is DBCC FREEPROCCACHE and ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE CACHE (both with, or without a plan_handle).
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 20, 2021 at 1:33 pm
No, the exec plan definitely survived - there was still the same, weeks old creation_time.
Moreover, should there be a reset of all columns/values, I would have no issue with that. The actual issue is that only total_elapsed_time was reset and all other values were going on - which resulted in malformed AVG values:
Which just did not fit together...
Maybe I could explain why I experience reset of total_elapsed_time and not other fields.
I'm getting the reset for several different queries, all of them sharing the same characteristics:
(may look like a poor app design but the use case is rather healthy: it is an import of data from a 3rd party system, and the actual blocking level depends on the actual data, which is highly different each time => sometimes there is almost no lock wait and other times everything is blocked).
I think that all other columns/values may be subject to the same reset, but they are really unlikely to hit the reset threshold as all other counters represent a serious consumption of resources (CPU, disk IO) => cannot grow as quickly as elapsed time in this parallel-long-wait use case => not likely that any exec plan would survive long enough to hit the threshold.
Maybe you could make a quick check of your environments:
select max(total_elapsed_time) from sys.dm_exec_query_stats;
I guess that the number will be way bellow the reset threshold I identified => you are unlikely to hit this issue:
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply