Use sp_whoisactive to see the active queries

Useful sp_whoisactive parameters to see the queries running now: execution plans, blocking chain leaders, memory grant information, average duration.

sp_whoisactive is Adam Machanic’s stored procedure. It shows what is running on an instance right now, in a far more readable form than sp_who2.

Useful parameters

  • @get_plans — tinyint, 0 by default. Set to 1 to include the plan of the running statement in the output, or to 2 to get the entire plan of the batch or procedure.
  • @find_block_leaders — bit, 0 by default. Set to 1 to identify the sessions at the head of a blocking chain, and the number of sessions each one blocks.
  • @get_memory_info — exposes the memory grant information for the query.
  • @get_avg_time — bit, 0 by default. Set to 1 to add the average duration of past runs of the active query, read from sys.dm_exec_query_stats.