Wednesday, August 23, 2017

How to check which query take time on server

This is the following query which tell how much time it will take on server the status field, if it show running then its fine and if it show suspended its means :

The session is waiting for an event, such as I/O, to complete.
A query gets suspended when it is requesting access to a resource that is currently not available. This can be a logical resource like a locked row or a physical resource like a memory data page. The query starts running again, once the resource becomes available.
High disk IO means that a lot of data pages need to be accessed to fulfill the request

SELECT sqltext.TEXT,
req.session_id,
req.status,
req.command,
req.cpu_time,
req.total_elapsed_time
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext

No comments:

Post a Comment