Get Top Resource Queries
mssql_top_queriesRank SQL Server queries by CPU, logical reads, memory grants, spills, duration, or executions from the plan cache, and return statement text with plan handles for deeper analysis.
Instructions
Top queries by CPU, logical reads, memory grant, spills, duration or executions, from the plan cache (sys.dm_exec_query_stats), with statement text and the Plan Handle for mssql_execution_plan. topN default 25, max 100.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topN | No | Number of queries to return (1–100). | |
| sortBy | No | Resource dimension to sort by. | cpu |