Skip to content

WS4: missing-index + plan-warning advise-only recommendations (from collected plans)#1078

Merged
erikdarlingdata merged 2 commits into
devfrom
feature/ws4-plan-index-advice
Jun 8, 2026
Merged

WS4: missing-index + plan-warning advise-only recommendations (from collected plans)#1078
erikdarlingdata merged 2 commits into
devfrom
feature/ws4-plan-index-advice

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

What

Surfaces the optimizer's missing-index requests and actionable plan warnings as advise-only recommendations — parsed from the already-collected query plans with the existing ShowPlanParser/PlanAnalyzer. No DMV, no new collection, no schema.

How

  • Shared PlanAdvisoryAggregator (PerformanceMonitor.PlanAnalysis): parses a set of plan XMLs → deduped missing indexes + warnings; a malformed plan is skipped (never aborts the batch). Added ParsedPlan.AllWarnings (statement + node-tree) next to the existing AllMissingIndexes.
  • Fact collectors (both apps) parse the top 10 collected plans by cost in the window → MISSING_INDEX / PLAN_WARNING facts (numeric metadata: counts, max impact, critical count). Dashboard reads collect.query_stats.query_plan_text (DECOMPRESS); Lite reads query_stats.query_plan_xml.
  • Scoring/rooting/advice (shared): 0.4 when present; rooted standalone below 0.5 (ConfigAdvisoryRootKeys); advise-only FactAdvice blocks.
  • Drill-down enrichment (both apps) re-parses the same plans to attach the specific suggested indexes (table, impact, CREATE) + warnings to the finding's DrillDownFact.Metadata is numeric-only, so the strings live there (the WS3-autogrowth pattern). Runs above the 0.5 display gate.

Advise-only — no RemediationAction/handler/Apply (creating indexes / rewriting queries is a DBA judgement call).

Verification

  • Dashboard.Tests 445 (+11), Lite.Tests 362 (no regression); both apps build clean.
  • The parser is the proven production one (Plan Viewer + bad-actor drill-down). WS4's aggregator resilience (malformed/empty/null → skipped, no throw) is unit-tested; the real parse→emit is exercised by the live analysis path (no plan-XML fixtures exist, and a hand-built SHOWPLAN fixture would be fragile/misleading).

⚠️ Stacked on WS5

Base is feature/ws5-lpim-ifi-dump-facts (#1076), not dev — it shares FactScorer/FactAdvice/InferenceEngine. Merge #1076 first, then this retargets to dev cleanly.

🤖 Generated with Claude Code

…llected plans

Surface the optimizer's missing-index requests and actionable plan warnings as advise-only
recommendations, parsed from the ALREADY-collected query plans (collect.query_stats.query_plan_text
on Dashboard; query_stats.query_plan_xml in Lite's DuckDB) with the existing ShowPlanParser /
PlanAnalyzer — no DMV, no new collection, no schema.

- Shared PlanAdvisoryAggregator (PerformanceMonitor.PlanAnalysis): parses a set of plan XMLs and
  aggregates deduped missing indexes + warnings; a malformed plan is skipped, never aborts the set.
  Added ParsedPlan.AllWarnings (statement + node-tree) alongside the existing AllMissingIndexes.
- Fact collectors (both apps): parse the top 10 collected plans by cost in the analysis window and
  emit MISSING_INDEX (Value = distinct suggested indexes) + PLAN_WARNING (Value = actionable
  warnings) facts with numeric metadata.
- FactScorer scores each 0.4 when present (else 0); InferenceEngine roots them standalone below the
  0.5 threshold (ConfigAdvisoryRootKeys); FactAdvice gives each an advise-only block.
- Drill-down enrichment (both apps): re-parses the same top plans to attach the specific suggested
  indexes (table, impact, CREATE) + warnings to the finding DrillDown -- Fact.Metadata is numeric
  only, so the strings live there (same pattern as WS3 autogrowth's alter_statement). Runs above
  the 0.5 display gate, like the config drill-downs.

Advise-only -- no RemediationAction/handler/Apply (creating indexes / rewriting queries is a DBA
judgement call). Dashboard.Tests 445 (+11), Lite.Tests 362 (no regression); both apps build clean.
The parser is the proven production one (Plan Viewer / bad-actor drill-down); WS4's aggregator
resilience is unit-tested and parse->emit is exercised by the live analysis path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata changed the base branch from feature/ws5-lpim-ifi-dump-facts to dev June 8, 2026 13:50
@erikdarlingdata erikdarlingdata merged commit 44d4e1b into dev Jun 8, 2026
2 checks passed
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.

1 participant