# 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.
>
> Source : https://www.pachadata.com/en/docs/howtos/troubleshooting/sp-whoisactive/
> Author : Rudi Bruchez · updated 2026-10-14
> Markdown version of the page, for tools and LLMs. The HTML page is the reference.


[`sp_whoisactive`](https://github.com/amachanic/sp_whoisactive/releases) 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`.


---

## About the author

Rudi Bruchez, independent SQL Server consultant since 2006: performance audits, tuning, migrations, high availability and training. For an audit or hands-on help on your server: https://www.pachadata.com/en/contact/ (remote audit: https://www.pachadata.com/en/services/remote-sql-server-audit/).
