Sample Header Ad - 728x90

How can Last_Execution_time be before Creation_time?

2 votes
0 answers
141 views
sp_HealthParser (made by Erik Darling) crashed on me, because Last_Execution_time was way before Creation_time.
How is that possible? The columns : **Last_execution_time** in sys.dm_exec_query_stats should, in my book, be on or after **Creation_time** (from the same sys.dm_exec_query_stats)? The query fails at datediff ( SECOND, deqs.creation_time, deqs.last_execution_time ) , 0) which I've fixed by adding a case statement like this: case when deqs.creation_time < deqs.last_execution_time then datediff ( SECOND, deqs.creation_time, deqs.last_execution_time ) else 0 end I now get 1106 rows with last_execution_time equal to **1900-01-01 00:00:00.000**, all with plan_generation_num=1 and execution_count=1 enter image description here
Asked by Henrik Staun Poulsen (2291 rep)
Oct 22, 2023, 05:22 PM
Last activity: Jul 31, 2025, 09:02 AM