slow-query-investigation
Slow Query Investigation
Scope
- Correlate Query Store, plan-cache DMVs, waits, time windows, and statistics before attributing the cause to parameter sniffing or a plan regression.
- For a broad Query Store inventory, use
query-store-investigation; to list cached top queries when Query Store is unavailable, usetop-queries-noqds.
Azure SQL Database specialization
For Azure SQL Database (EngineEdition 5), read Azure-specific guidance before choosing diagnostic queries. It preserves the service-specific permissions, capture limitations and error interpretation. Keep this skill's scope and authorization rules; the reference is not a second workflow to run unconditionally.
Evidence limits and incident arithmetic
Check Query Store's actual state and capture mode. AUTO capture is not a complete execution log: an infrequent statement may be absent, and flushing cannot recover a statement never captured. A cached compiled plan with nonzero use count does not guarantee a matching execution-statistics row. Read the fallback's limitations before declaring the query absent.
Query Store duration and CPU averages are in microseconds. Aggregate execution groups with SUM(count_executions * avg_value) / SUM(count_executions), not an unweighted average; compare each query with its own baseline and time window. Preserve query/plan/interval IDs and duration spread. Follow the measured wait category: blocking and resource pressure are not automatically plan regressions. Use incident evidence rules when correlating captures. Supplied historical evidence describes that capture; current DMVs cannot replace it.