Как найти в таблице sp_whoisactive по времени выполнения запроса.

SELECT [dd hh:mm:ss.mss]
,[start_time]
 ,[collection_time]
      ,[session_id]
      ,[sql_text]
      ,[sql_command]
      ,[login_name]
      ,[wait_info]
      ,[tran_log_writes]
      ,[CPU]
      ,[tempdb_allocations]
      ,[tempdb_current]
      ,[blocking_session_id]
      ,[reads]
      ,[writes]
      ,[physical_reads]
      ,[query_plan]
      ,[used_memory]
      ,[status]
      ,[tran_start_time]
      ,[open_tran_count]
      ,[percent_complete]
      ,[host_name]
      ,[database_name]
      ,[program_name]
      
      ,[login_time]
      ,[request_id]
      ,[collection_time]
  FROM [DBAtools].[dbo].[WhoIsActive]
  WHERE 
 CONVERT(CHAR(8),COLLECTION_time,8) BETWEEN '00:00:00' AND '23:00:00' AND
       datepart(YEAR,start_time) BETWEEN 2020 AND 2020 and
       datepart(month,start_time) BETWEEN 04 AND 04 and
       datepart(day,start_time) BETWEEN 22 AND 23
     and  [dd hh:mm:ss.mss]  > '00 01:00:00.0000'

 

You may also like...