SQL Server Cached SQL


The SQL Server Cached SQL page shows expensive cached queries and execution statistics collected from the SQL Server instance. Use it to find high-impact statements that may need tuning.

Mini DBA SQL Server cached SQL

What To Look For

  • High total CPU.
  • High total reads or writes.
  • Long elapsed time.
  • Frequent execution count.
  • Expensive recent statements.
  • Queries with available execution plans.

Query Detail

Selecting a query can open detail with SQL text, metrics, badges, and execution plan loading where supported. Use SQL Server Execution Plans to inspect statements, expensive operators, warnings, parameters, missing indexes, and plan XML. If AI analysis is enabled in AI Provider settings, assisted query and plan interpretation may be available.

Workflow

  1. Sort by CPU, duration, reads, writes, or execution count.
  2. Open the query detail.
  3. Review SQL text and plan, then drill into expensive operators where they explain the cost.
  4. Compare with Query Store for history.
  5. Use Performance Tune for recommendation-style review.

How To Prioritize Cached SQL

Cached SQL is most useful when you look for high total impact and high per-execution impact separately. A query with a huge total CPU value may be cheap per execution but called thousands of times. A query with a smaller total cost may still be critical if each execution is slow for users. Use execution count, average duration, total reads, total CPU, writes, and the SQL text together.

If a query appears here but not in Query Store, it may be new, ad hoc, evicted from history, or running in a database where Query Store is not enabled. If it appears in Query Store but not in cached SQL, it may not currently be in plan cache. That is why the best SQL Server performance workflow compares both pages.

SQL Server Query Tuning FAQ

Does cached SQL show every query ever run?

No. It shows statements represented in SQL Server cache and related collected metrics. SQL Server can evict plans, and service restarts clear cache.

What should I tune first?

Start with queries that combine high business importance with high resource use. The most expensive query is not always the best first fix if it runs during a batch window and does not affect users.

Can Mini DBA show execution plans?

Where SQL Server exposes plan handles and the account has sufficient permissions, Mini DBA can load execution plan detail from query pages. See SQL Server Execution Plans for the plan viewer controls and AI plan review workflow.

Related Pages