SQL Server Toolset Overview: Diagnostic Tools to Keep

6 min read

A SQL Server diagnostic toolset should cover activity capture, server state and query behaviour. Start with sys.dm_os_wait_stats and sys.dm_exec_requests for blocking, then inspect the execution plan, add Query Store history from SQL Server 2016, and switch to Extended Events for targeted tracing. Keep DBCC CHECKDB separate for integrity checks.

The sql server toolset overview below separates performance work into three layers: activity capture, server state and query behaviour. It does not list every SSMS 2008 screen or work through each menu; it orders the current diagnostic tools by the jobs they do. You can use these steps on SQL Server 2016 and later, with older alternatives noted only where they still apply.

On this page
  1. The practice
  2. Why it matters
  3. How to apply it
  4. Common objections
  5. Quick check

The practice

The sql server diagnostic tools that matter are not a toolbar; they are three lenses. Each lens answers a different question, and you can use all three on SQL Server 2016 and later; most wait DMVs appeared earlier, but Query Store changed what you can save. Keep DBCC CHECKDB out of this performance sequence because integrity checks are a separate operation.

  • Waits and blocking tell you what the server is waiting on now. sys.dm_os_wait_stats aggregates completed waits by wait_type, and its Microsoft Learn page lists waiting_tasks_count, wait_time_ms and max_wait_time_ms for each type.
  • Execution plans and Query Store show how a query behaves before and after it runs, and they answer whether the problem is the plan or the workload.
  • Extended Events captures targeted events when a one-off DMV snapshot is not enough; a filtered extended events sql server session is for rare failures, not permanent monitoring.

The order follows the data: check the server, then the query, then the event.

Why it matters

Without an order, you open Profiler or SSMS and watch whatever happens, which floods a busy server with events you then ignore. The result is a long trace with no clear start, so you tune the wrong layer of the stack. Another common failure is looking at an estimated plan before the query has run; an actual execution plan includes row counts from execution, while an estimated plan shows costs and inferred rows. The estimated plan can look cheap while the actual plan, with execution row counts, shows the operator that multiplied or spilled rows. Skipping wait stats hides the clearest signal: lock waits, I/O waits and CPU pressure separate cleanly in sys.dm_os_wait_stats by wait type. That single view splits contention into names you can act on. Page-level contention appears there as slow I/O, and page splits add I/O that later checks can fix. If you skip server state, you can spend an hour tuning a query whose table is blocked by a maintenance job.

How to apply it

Apply the sequence below in three passes: confirm server state, inspect the slow query, then add targeted event capture. Each pass has one DMV or tool and one column or metric you can verify. If you skip a pass, the next one gives you a partial answer.

Diagnostic order for a slow query

Use this sequence when a query is slow and you do not yet know whether the cause is server contention, a bad plan or a missing event. Each row below names the view, the column that carries the answer, and the next check.

StepView or toolValue it returnsNext action
1. Server snapshotsys.dm_os_wait_statswait_type and wait_time_ms per wait typePick the dominant wait and fix it before query tuning.
2. Blocking chainsys.dm_exec_requestsblocking_session_id, wait_type, wait_timeTrace the chain to the head blocker.
3. Actual planActual execution planrow counts and operator timingsFind the operator with the largest row-count difference.
4. Query historyQuery Storequery plans and runtime intervalsCompare plans for the same query_id before and after the slowdown.
5. Targeted traceExtended Events sessionthe events and fields you filterCapture only the failing statement or event.

The value of each step is the column it returns: wait_type and blocking_session_id identify what to fix, rather than leaving you with a trace to interpret.

Wait stats and blocking: the DMVs to run

Start with the server view, not the query. The columns you need in sys.dm_os_wait_stats are wait_type, waiting_tasks_count and wait_time_ms, all documented on Microsoft Learn. Query the top wait types, then check blocking with sys.dm_exec_requests.

SELECT TOP 10 wait_type,
       waiting_tasks_count,
       wait_time_ms
FROM sys.dm_os_wait_stats
ORDER BY wait_time_ms DESC;
SELECT session_id, blocking_session_id, wait_type, wait_time, command
FROM sys.dm_exec_requests
WHERE blocking_session_id <> 0;

The blocking_session_id value points to the session blocking the request, or shows a special negative code for orphaned transactions and latch conditions. Do not invent wait thresholds; read the types of waits on the same Microsoft Learn page and start from the largest wait time.

Execution plans and Query Store

Look at an actual execution plan after you have observed the wait. The plan shows the row counts the operators returned, not only the estimates. Estimated plans help before running, but they do not show the actual rows that changed the cardinality estimate. Query Store adds history: it is available from SQL Server 2016 onward, so on SQL Server 2014 and earlier you only have the current plan cache. Keep Query Store enabled on critical databases, but do not treat it as a replacement for the wait stats check. In Query Store, compare the same query across runtime intervals to see when the plan changed and what the newer plan did differently. This matters because a plan regression often shows up as a new plan with higher duration for the same query text. The actual plan's row counts are the evidence you need before you change an index or a query. If you only have the estimated plan, you are guessing about the operation that caused the slowdown.

Extended Events for targeted tracing

Use Extended Events when interval snapshots miss the event. Choose this when a DMV shows a wait but not the session that started it, or when the failure is intermittent. Extended Events was introduced in SQL Server 2008, and it gives you a lightweight session for a narrow event such as a specific error_reported or a wait type transition. Keep the session filtered: a broad session on a busy server collects more noise than signal. A minimal session might target a single database and a single event, so the output stays small enough to read. If you capture everything, the session becomes a slower version of the trace you meant to replace. For blocking, blocked process reports can arrive through event notifications, which is a different path from a DMV snapshot.

Common objections

Some DBAs push back on the wider toolset. “I only use DMVs” misses history: DMVs give a point-in-time snapshot, while Query Store keeps that history from SQL Server 2016. “Extended Events is not for production” confuses the feature with an unfiltered session; it runs inside the engine, and the problem is usually the session definition, not the cost of the feature. “Query Store is not available” is correct for SQL Server 2014 and earlier, so use DMV snapshots and plan cache checks there. The objection that matters is not which tool, but whether you can reproduce the event later without another outage. The tools in this order are cheap to run; the expensive part is looking at the wrong layer first.

Quick check

Before closing a support call, confirm five things:

  • You know the dominant wait_type and its wait_time_ms from a server snapshot.
  • You traced blocking_session_id to a head blocker or saw none.
  • You opened the actual execution plan and noted the row-count difference on one operator.
  • You checked Query Store history for the query, if the instance is SQL Server 2016 or later.
  • You ran DBCC CHECKDB on a restored copy separately from performance work.

If you need to move data out for testing, Generate INSERT scripts from SSMS first.

SQL blogcasts

SET_NOCOUNT_ON

Technical notes on SQL Server for DBAs and developers: why a query or job behaves as it does and how to fix it, with T-SQL that runs and the version it was tested on.

More notes

Go up