Skill 2.2.3

Evaluate query performance by using query execution plans, dynamic management views (DMVs), Query Store, and Query Performance Insight

Key Concepts

An estimated plan shows the optimizer's choices without running the query; an actual plan adds real row counts, so large gaps between estimated and actual rows point to stale statistics or parameter sensitivity. Warnings such as implicit conversion, spills to tempdb, key lookups and missing index suggestions identify fixes. DMVs describe current and cumulative state: sys.dm_exec_requests (running requests, waits and blocking), sys.dm_exec_query_stats with sys.dm_exec_sql_text and sys.dm_exec_query_plan (cached plans and their cost), sys.dm_db_wait_stats and sys.dm_db_resource_stats in Azure SQL Database, and the missing index DMVs.

Query Store persists queries, plans, runtime statistics and wait statistics over time and survives restarts, which makes it the tool for regressions; it is on by default in Azure SQL Database. Its views (sys.query_store_query, sys.query_store_plan, sys.query_store_runtime_stats) and reports show regressed and top-consuming queries, sp_query_store_force_plan forces a plan and sp_query_store_set_hints applies hints without code changes. Query Performance Insight in the Azure portal reads Query Store data to chart the top queries by CPU, duration or execution count.