dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
Home/Glossary/Query Store
Query StorePerformance & Memory

Query Store (Sorgu Mağazası & Plan Regresyon Yakalayıcı)

The persistent database engine flight recorder that captures historical query execution plans, runtime performance statistics, and plan regression anomalies.

Internal Architecture Breakdown

Unlike ephemeral DMVs cleared on server restarts, Query Store persists runtime metrics, query texts, and execution plans directly inside the user database.

When a schema change, parameter sniffing, or statistics update produces a regressed query plan, SREs can inspect regressions visually and force the known good plan instantly via sp_query_store_force_plan or enable Automatic Tuning.

Production Inspection Queries

SQL Server
SELECT qsq.query_id, qsp.plan_id, qst.query_sql_text, qrs.count_executions, qrs.avg_duration / 1000.0 AS avg_duration_ms, qrs.avg_cpu_time / 1000.0 AS avg_cpu_ms FROM sys.query_store_query qsq JOIN sys.query_store_query_text qst ON qsq.query_text_id = qst.query_text_id JOIN sys.query_store_plan qsp ON qsq.query_id = qsp.query_id JOIN sys.query_store_runtime_stats qrs ON qsp.plan_id = qrs.plan_id ORDER BY qrs.avg_duration DESC;