5

(Related to this question)

If I want to see if there are currently any long-running queries executing on my database, what's the easiest way of checking? (I expect the answer will be some query on master..sysprocesses?)

8

WhoIsActive from Adam Machanic is an excellent tool/sp to see what's currently happening on your server.

The below tutorial from Brent Ozar shows how to periodically log sp_whoisactive to a table for later analysis.

https://www.brentozar.com/responder/log-sp_whoisactive-to-a-table/

1

I use the following query to get information about currently running queries. It has the advantage of not requiring any additional packages or addons:

SELECT * 
FROM sys.dm_exec_requests 
CROSS APPLY sys.dm_exec_sql_text(sql_handle)

You would probably be most interested in the [start_time], [total_elapsed_time], and [text] fields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.