π Now available on the VS Code Marketplace! Install directly from VS Code without any build steps.
A cross-platform VS Code extension that brings SQL Server Management Studio's Query Store report suite directly into VS Code. Works on macOS, Linux, and Windows.
Requires the SQL Server (mssql) extension β it is listed as a dependency and will be installed automatically.
| Report | Description |
|---|---|
| Top Resource Consuming Queries | Ranks queries by a selected metric (duration, CPU, IO, memory, row count). Includes execution type breakdown (Regular, Aborted, Exception). Horizontal bar chart + sortable grid. |
| Regressed Queries | Finds queries whose average duration has grown compared to a historical baseline. Includes execution type breakdown. Grouped bar chart comparing recent vs. historical cost. |
| Queries with High Variation | Surfaces queries with unpredictable execution times (high coefficient of variation). Includes execution type breakdown. Identifies plan instability. |
| Overall Wait Statistics | Shows aggregate wait time by category (CPU, I/O, Lock, Memory, etc.) for the selected time window. |
| Forced Plans | Lists all queries with a forced execution plan, including failure counts and reasons. Provides a one-click Remove Forced Plan action. |
| Overall Resource Consumption | Day-by-day trend of total executions, duration, CPU, I/O, memory, and wait time. Multi-series line chart with per-metric toggles. |
Every query-level report supports drill-down: click any row to open a split panel showing:
- Per-plan execution statistics over time (line chart bucketed by minute)
- The query execution plan rendered as an interactive SVG diagram
- When a query has multiple plans, click any plan label in the chart legend to switch between them
- VS Code 1.85 or later
- SQL Server (mssql) extension
- SQL Server 2016 or later (Query Store was introduced in SQL Server 2016)
- Query Store must be enabled on the target database:
ALTER DATABASE [YourDatabase] SET QUERY_STORE = ON;
The easiest way to install is directly from the VS Code Marketplace:
- Extensions view: Open the Extensions view (
Ctrl+Shift+X/Cmd+Shift+X), search for "SQL Server Query Store Reports", and click Install. - Marketplace listing: Visit the Marketplace listing page and click Install.
- Command line:
code --install-extension DennyCherryandAssociatesCOnsulting.query-store-reports
-
Build the
.vsixpackage:git clone https://github.com/jdanton/query-store-reports.git cd query-store-reports npm install npm run build npx vsce packageThis produces a file like
query-store-reports-0.4.0.vsix. -
In VS Code: Extensions β
Β·Β·Β·menu β Install from VSIXβ¦ -
Select the
.vsixfile.
git clone https://github.com/jdanton/query-store-reports.git
cd query-store-reports
npm install
npm run compileThen press F5 in VS Code to launch an Extension Development Host.
Method 1 β Right-click on a database node:
- Open the SQL Server explorer (SQL icon in the activity bar).
- Connect to your server and expand the Databases folder.
- Right-click any database β Query Store β choose a report.
Method 2 β Command Palette:
- Open the Command Palette (
Cmd+Shift+P/Ctrl+Shift+P). - Type
Query Storeand select a report. - If no connection is active, a picker will appear listing your saved connections.
The extension reads connection profiles saved in the mssql extension (mssql.connections in your VS Code settings).
| Auth type | Behavior |
|---|---|
| SQL Login | Password is retrieved from VS Code's secret storage. If not saved, you'll be prompted once and offered the option to store it. |
| Windows / Integrated | Uses the ambient Windows identity. |
| Azure AD / Entra ID (MFA) | Authenticates via VS Code's built-in Microsoft auth provider β uses the same account you are signed into in VS Code. Works with Azure SQL Database and Managed Instance. |
Each report's toolbar exposes the parameters that drive its query.
| Preset | Window |
|---|---|
| Last 1 hour | now β 1h β now |
| Last 4 hours | now β 4h β now |
| Last 24 hours | now β 24h β now |
| Last 7 days | now β 7d β now |
| Last 30 days | now β 30d β now |
| Custom⦠| Exposes start/end datetime pickers |
| Parameter | Description |
|---|---|
| Recent Period | The "current" window to evaluate (default: last 1 hour) |
| History Period | The baseline window to compare against (default: last 7 days) |
| Min Executions | Only include queries with at least this many executions in the recent window (filters noise) |
| Parameter | Description |
|---|---|
| Metric | Ranking metric β Duration, CPU Time, Logical/Physical IO Reads/Writes, Memory, or Row Count |
| Min Plans | Only include queries with at least this many distinct execution plans (default: 1) |
| Metric | Column |
|---|---|
| Duration (ms) | SUM(avg_duration Γ executions) Γ 0.001 |
| CPU Time (ms) | SUM(avg_cpu_time Γ executions) Γ 0.001 |
| Logical IO Reads (KB) | SUM(avg_logical_io_reads Γ executions) Γ 8 |
| Logical IO Writes (KB) | SUM(avg_logical_io_writes Γ executions) Γ 8 |
| Physical IO Reads (KB) | SUM(avg_physical_io_reads Γ executions) Γ 8 |
| Memory (KB) | SUM(avg_query_max_used_memory Γ executions) Γ 8 |
| Row Count | SUM(avg_rowcount Γ executions) |
Click any row in a report grid to open the drill-down panel. The lower section renders the XML execution plan as an SVG node graph:
- Node color encodes relative cost: green (cheap) β red (expensive).
- Variable edge thickness β edge lines scale logarithmically with estimated row count, making heavy data flows easy to spot.
- Arrowheads on edges indicating data flow direction.
- Row count labels at the midpoint of each edge.
- Object names displayed on nodes (e.g.,
dbo.Users.PK_Users) when the operator references a table or index. - Warning badges (β ) on nodes with SpillToTempDb, NoJoinPredicate, missing statistics, or unmatched indexes.
- Parallelism indicators (β) on parallel operators.
- Structured tooltips β hover over a node to see a formatted card with operator name, cost metrics (CPU, I/O, subtree cost, estimated rows), object name, and warnings.
- Edge tooltips β hover over an edge to see estimated rows, row size, and data size.
- Zoom controls (Fit / + / β) in the plan toolbar.
- Force This Plan button stores the displayed plan as the forced plan for the query (
sp_query_store_force_plan). - Remove Forced Plan reverts to automatic plan selection (
sp_query_store_unforce_plan).
The plan viewer parses the standard SQL Server XML Showplan format. Plans from SQL Server 2016 through SQL Server 2022 and Azure SQL Database are supported.
All queries include a @replica_group_id parameter, which defaults to 1 (the primary replica). On SQL Server 2022+ instances with Always On Availability Groups or Azure SQL Hyperscale, the extension automatically detects available replicas by querying sys.query_store_replicas. When multiple replicas are found, a Replica dropdown appears in the toolbar allowing you to view Query Store statistics for any replica. On older SQL Server versions where this DMV does not exist, the selector is hidden and the primary replica is used automatically.
- Query Store must be enabled β if it is off, the extension will prompt you with an option to enable it (
ALTER DATABASE β¦ SET QUERY_STORE = ON). This requires ALTER permission on the database. - Encrypted modules β queries inside natively compiled or encrypted modules show as
<restricted text>per SQL Server's own access controls. - Plan XML β very large plans (thousands of nodes) may render slowly. Use the Fit button to reset zoom.
- Windows Integrated auth on macOS β requires a Kerberos ticket (
kinit). Azure AD / Entra ID is the recommended alternative on non-Windows hosts. - Server address format β the extension handles both
host,port(SQL Server convention) and separate port configuration automatically.
See DEVELOPMENT.md for the full architecture guide, build instructions, and instructions for adding new reports.
MIT
