get_top_cached_queries
Retrieve top cached SQL statements from Azure SQL Database, showing execution counts, CPU time, and logical reads. Pinpoint resource-intensive queries for performance tuning.
Instructions
Get top cached statements from sys.dm_exec_query_stats. Returns bounded text previews and plan-cache metrics without raw plan XML.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum cached queries to return. | |
| sort_by | No | Sort by execution_count, total_worker_time, avg_worker_time, total_elapsed_time, avg_elapsed_time, total_logical_reads, total_physical_reads, or total_logical_writes. | total_worker_time |
| database_name | No | Optional database name. Defaults to AZURE_SQL_DEFAULT_DATABASE. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||