Skip to content

Add execution plan comparison - #22695

Draft
Aasim Khan (aasimkhan30) wants to merge 7 commits into
mainfrom
aasim/feat/executionPlanComparison
Draft

Add execution plan comparison#22695
Aasim Khan (aasimkhan30) wants to merge 7 commits into
mainfrom
aasim/feat/executionPlanComparison

Conversation

@aasimkhan30

Copy link
Copy Markdown
Contributor

Summary

  • add a dedicated execution plan comparison webview for comparing plans from query results or saved plan files
  • support statement selection, side-by-side and top-and-bottom layouts, synchronized zoom, and independent panning for differently sized plans
  • visualize matched operator groups and size similarity overlays to include complete rendered nodes and labels
  • add a resizable comparison properties pane backed by a virtualized Fluent DataGrid
  • add property filtering, importance/alphabetical sorting, resizable columns, and accessible keyboard interactions
  • add comparison controller/model coverage and localized UI strings

Validation

  • npm run build:webviews
  • focused ESLint and Prettier checks for the updated comparison webview files
  • 24 focused unit tests passed:
    • executionPlanComparisonModel.test.ts
    • executionPlanWebviewController.test.ts
  • non-generated git diff --check

The full execution plan E2E suite requires the VS Code and SQL integration test harness and was not run locally.

Aasim Khan (aasimkhan30) and others added 7 commits July 30, 2026 00:30
…lanComparison

# Conflicts:
#	extensions/mssql/l10n/bundle.l10n.json
#	extensions/mssql/package.json
#	extensions/mssql/package.nls.json
#	extensions/mssql/src/controllers/executionPlanWebviewController.ts
#	extensions/mssql/src/previews/previewService.ts
#	extensions/mssql/src/queryResult/queryResultWebViewController.ts
#	extensions/mssql/src/sharedInterfaces/executionPlan.ts
#	extensions/mssql/src/webviews/common/icons/executionPlanIcons.css
#	extensions/mssql/src/webviews/common/icons/executionPlanIcons.tsx
#	extensions/mssql/src/webviews/common/locConstants.ts
#	extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanGraph.tsx
#	extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanModel.ts
#	extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanTooltip.ts
#	extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanView.ts
#	extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanViewport.ts
#	extensions/mssql/src/webviews/pages/ExecutionPlan/highlightExpensiveOperations.tsx
#	extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowExecutionPlan.css
#	extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowExecutionPlan.tsx
#	extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowIconMenu.tsx
#	extensions/mssql/test/e2e/executionPlan.spec.ts
#	extensions/mssql/test/unit/executionPlanModel.test.ts
#	extensions/mssql/test/unit/executionPlanViewport.test.ts
#	extensions/mssql/test/unit/executionPlanWebviewController.test.ts
#	extensions/mssql/test/unit/previewService.test.ts
#	extensions/mssql/test/unit/queryResultWebViewController.test.ts
#	localization/xliff/vscode-mssql.xlf

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a dedicated execution plan comparison experience, wiring new controller/state/model support to a React Flow-based comparison webview with synchronized zoom, selectable statements, and a virtualized properties pane.

Changes:

  • Introduces a new execution plan comparison webview (UI + CSS) and a comparison model for matched nodes / property row generation.
  • Adds a new ExecutionPlanComparisonWebviewController, source registry support, and SQL Tools Service compare call plumbing.
  • Integrates “Compare Execution Plan” entry points from existing execution plan/query result webviews and adds unit test coverage.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
localization/xliff/vscode-mssql.xlf Adds localized strings for the comparison feature (auto-generated localization).
extensions/mssql/l10n/bundle.l10n.json Adds localized strings for backend/webview comparison labels (generated bundle).
extensions/mssql/src/constants/locConstants.ts Adds backend localized constants for compare editor titles and QuickPick messaging.
extensions/mssql/src/controllers/executionPlanComparisonWebviewController.ts New controller to manage plan selection, loading, and comparison requests/state.
extensions/mssql/src/controllers/executionPlanSourceRegistry.ts New registry for tracking open execution plan sources for reuse in comparison.
extensions/mssql/src/controllers/executionPlanWebviewController.ts Registers opened plan sources and adds a reducer to open the comparison webview.
extensions/mssql/src/controllers/sharedExecutionPlanUtils.ts Adds helper to open the comparison webview controller.
extensions/mssql/src/queryResult/utils.ts Adds reducers to open comparison from query results when React Flow preview is enabled.
extensions/mssql/src/services/executionPlanService.ts Implements compareExecutionPlanGraph request to SQL Tools Service.
extensions/mssql/src/sharedInterfaces/executionPlan.ts Extends shared interfaces/state/provider/service contracts for comparison mode.
extensions/mssql/src/webviews/common/icons/executionPlanIcons.tsx Adds reset-zoom icon and a numbered “search plan” icon.
extensions/mssql/src/webviews/common/icons/executionPlanIcons.css Styles the numbered plan badge and improves high-contrast behavior.
extensions/mssql/src/webviews/common/locConstants.ts Adds webview localized strings for comparison UI and property table labels.
extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanComparison.css New styling for split panes, toolbar, and virtualized comparison properties grid.
extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanComparison.tsx New comparison webview UI: pane layout, zoom sync, find, and properties grid.
extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanComparisonModel.ts New model utilities for match maps and property row comparison/flattening.
extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanGraph.tsx Passes graph index / compare capability down to the React Flow icon stack.
extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanPage.tsx Routes to comparison UI when comparison state is present.
extensions/mssql/src/webviews/pages/ExecutionPlan/executionPlanStateProvider.tsx Adds comparison actions to the execution plan webview RPC provider.
extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowExecutionPlan.css Adds overlay styling for comparison “matched group” bounding boxes.
extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowExecutionPlan.tsx Adds selection callback, external viewport control, and comparison group overlays.
extensions/mssql/src/webviews/pages/ExecutionPlan/reactFlowIconMenu.tsx Adds “Compare Execution Plan” toolbar button when comparison is available.
extensions/mssql/src/webviews/pages/QueryResult/queryResultStateProvider.tsx Adds comparison-related actions to query result webview RPC provider.
extensions/mssql/test/unit/executionPlanComparisonModel.test.ts New unit tests for comparison model map/row building behavior.
extensions/mssql/test/unit/executionPlanWebviewController.test.ts Adds tests for opening comparison and for comparison controller helper functions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +360 to +383
const comparisonIcon = (row: ExecutionPlanComparisonPropertyRow) => {
const comparisonLabel =
row.comparison === "greater"
? locConstants.executionPlan.greaterThan
: row.comparison === "less"
? locConstants.executionPlan.lessThan
: row.comparison === "different"
? locConstants.executionPlan.notEqual
: "";
return (
<span
className={`execution-plan-comparison-diff execution-plan-comparison-diff-${row.comparison}`}
title={comparisonLabel}
aria-label={comparisonLabel}>
{row.comparison === "greater" ? (
<ChevronRight16Regular />
) : row.comparison === "less" ? (
<ChevronLeft16Regular />
) : row.comparison === "different" ? (
<Dismiss16Regular />
) : undefined}
</span>
);
};
Comment on lines +111 to +117
const primaryNumber = Number.parseFloat(primary.displayValue);
const secondaryNumber = Number.parseFloat(secondary.displayValue);
if (!Number.isFinite(primaryNumber) || !Number.isFinite(secondaryNumber)) {
return "different";
}
return primaryNumber > secondaryNumber ? "greater" : "less";
}
@github-actions

Copy link
Copy Markdown

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 80663 KB 80677 KB ⚪ 14 KB ( 0% )
sql-database-projects VSIX 2899 KB 2899 KB ⚪ 0 KB ( 0% )
data-workspace VSIX 202 KB 202 KB ⚪ 0 KB ( 0% )
keymap VSIX 7 KB 7 KB ⚪ 0 KB ( 0% )

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.35564% with 331 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.57%. Comparing base (9bfde3c) to head (8d832cd).

Files with missing lines Patch % Lines
...ws/pages/ExecutionPlan/executionPlanComparison.tsx 1.27% 233 Missing ⚠️
...ages/ExecutionPlan/executionPlanComparisonModel.ts 83.14% 30 Missing ⚠️
...ews/pages/ExecutionPlan/reactFlowExecutionPlan.tsx 28.94% 27 Missing ⚠️
...tensions/mssql/src/webviews/common/locConstants.ts 66.66% 20 Missing ⚠️
extensions/mssql/src/queryResult/utils.ts 27.77% 13 Missing ⚠️
...pages/ExecutionPlan/executionPlanStateProvider.tsx 0.00% 6 Missing ⚠️
...webviews/pages/ExecutionPlan/executionPlanPage.tsx 75.00% 1 Missing ⚠️
...webviews/pages/ExecutionPlan/reactFlowIconMenu.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #22695      +/-   ##
==========================================
+ Coverage   87.53%   87.57%   +0.03%     
==========================================
  Files         340      344       +4     
  Lines      119835   120879    +1044     
  Branches      552      594      +42     
==========================================
+ Hits       104898   105855     +957     
- Misses      14937    15024      +87     
Flag Coverage Δ
data-workspace 78.34% <ø> (ø)
mssql 88.54% <68.35%> (+0.03%) ⬆️
sqlproj 79.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
extensions/mssql/src/constants/locConstants.ts 100.00% <100.00%> (ø)
...ollers/executionPlanComparisonWebviewController.ts 100.00% <100.00%> (ø)
...sql/src/controllers/executionPlanSourceRegistry.ts 100.00% <100.00%> (ø)
.../src/controllers/executionPlanWebviewController.ts 100.00% <100.00%> (ø)
.../mssql/src/controllers/sharedExecutionPlanUtils.ts 100.00% <100.00%> (ø)
...ensions/mssql/src/services/executionPlanService.ts 100.00% <100.00%> (ø)
...ebviews/pages/ExecutionPlan/executionPlanGraph.tsx 67.27% <ø> (ø)
...webviews/pages/ExecutionPlan/executionPlanPage.tsx 91.30% <75.00%> (-3.70%) ⬇️
...webviews/pages/ExecutionPlan/reactFlowIconMenu.tsx 86.66% <50.00%> (-1.27%) ⬇️
...pages/ExecutionPlan/executionPlanStateProvider.tsx 58.33% <0.00%> (-19.45%) ⬇️
... and 5 more

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants