SQL Server check which SQL query is take extra time or extra load.

Using this query you can easy to track that, Which running SQL Query is taking extra time or load, check reads and writes.

Output will be.


SELECT es.session_id
FROM sys.dm_exec_sessions es
    LEFT JOIN sys.dm_exec_connections ec 
        ON es.session_id = ec.session_id
    LEFT JOIN sys.dm_exec_requests er
        ON es.session_id = er.session_id
    OUTER APPLY sys.dm_exec_sql_text (er.sql_handle) st
WHERE es.session_id > 50    -- < 50 system sessions
ORDER BY es.cpu_time DESC