Mennyi ideig futott a szkript?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
set transaction isolation level read uncommitted select top 100 creation_time, last_execution_time, execution_count, qs.total_elapsed_time/1000 as TotDuration, convert(money, (qs.total_elapsed_time))/(execution_count*1000)as [AvgDur], case when sql_handle IS NULL then ' ' else(substring(st.text,(qs.statement_start_offset+2)/2,( case when qs.statement_end_offset =-1 then len(convert(nvarchar(MAX),st.text))*2 else qs.statement_end_offset end - qs.statement_start_offset)/2 )) end as query_text from sys.dm_exec_query_stats qs cross apply sys.dm_exec_sql_text(sql_handle) st order by AvgDur desc |
forrás:
https://dba.stackexchange.com/questions/205649/how-to-find-the-time-taken-to-execute-a-script