sqlplan-comparelisted
Install: claude install-skill vanterx/mssql-performance-skills
# SQL Server Execution Plan Comparison Skill
## Purpose
Identify what changed between two execution plans for the same query — one known-good (baseline) and one regressed (new). Produce a side-by-side diff that explains why the query is slower and what to fix. Applies 20 regression checks (C1–C20).
## Input
Accept any of:
- Two `.sqlplan` file paths: `baseline.sqlplan` and `new.sqlplan`
- Two blocks of raw `.sqlplan` XML pasted inline, labeled Baseline and New
- A description of both plans if XML is not available
## How to Run
1. Parse both plans independently
2. Extract the comparison metrics listed below for each plan
3. Produce a side-by-side diff table, then a findings section for every significant change
4. Conclude with a prioritized fix list
---
## Metrics to Compare
### Statement-Level
| Metric | Where to Find | Signal |
|--------|--------------|--------|
| StatementSubTreeCost | `StmtSimple/@StatementSubTreeCost` | > 2× increase = regression |
| DegreeOfParallelism | `QueryPlan/@DegreeOfParallelism` | DOP drop = serial plan forced |
| GrantedMemory (KB) | `MemoryGrantInfo/@GrantedMemory` | > 2× increase = cardinality inflation |
| MaxUsedMemory (KB) | `MemoryGrantInfo/@MaxUsedMemory` | Used > Granted = spill |
| CardinalityEstimationModelVersion | `QueryPlan/@CardinalityEstimationModelVersion` | Version drop = compat level change |
| CompileCPU (ms) | `StmtSimple/@CompileCPU` | > 2× increase = optimizer struggling |
| MissingIndexGroup count | `<MissingInde