Skip to content

VS Code: diagnose a slow plan

Used in C9, requirements 1 to 5, on vm-dev01 in plain Agent mode with the MSSQL extension, not the Upgrade agent.

Validated on: 2026-10-31 (documentation consistency with C9’s tool, baseline and evidence guidance; no new database or runtime check).

Capture the baseline first. Supply the query, its execution plan and Query Store measurements from the challenge’s current database. Remove secrets, identifiers and personal data from pasted output. Keep the saved original in your private evidence folder.

Diagnose this slow query from its execution plan and Query Store baseline: <paste the redacted query, plan and per-call measurements>.
Explain the operators and warnings that support your diagnosis. Separate observed facts from hypotheses and tell me what evidence is missing. Propose the smallest change that addresses the cause, checking existing objects and indexes first. Explain any effect on results or user-visible behavior.
Give me a candidate script to review, a rollback, and a before/after verification using the same query and workload. Do not execute changes, reset the database or clear Query Store. Do not claim improvement before it is measured.

Review the proposal against the plan before applying it as C9 directs. Keep one reviewed script per fix (p1-*.sql to p5-*.sql) and use C9’s two workload runs (baseline and after), not a separate workload run for every fix. Record per-call duration and reads, any behavior trade-off and the observed effect in factory/evidence/c09/ in C:\src\<your-repo> on main.

Return to C9 for the workload, capture commands and acceptance criteria.