Features/colored links#289
Conversation
• Added AccuracyRatioDivergenceLimit property (default: 10), persisted as "accuracy_ratio_divergence_limit" in the JSON settings file. PlanViewerControl (PlanViewerControl.axaml.cs) • 6 new link color brushes for dark theme: • Underestimated (more actual than estimated): Blue → Light Blue → Fluo Blue • Overestimated (fewer actual than estimated): Light Orange → Fluo Orange → Fluo Red • GetLinkColorBrush(PlanNode, double) method — maps accuracy ratio to a color band: • [0, 1/(limit×100)) → Fluo Blue • [1/(limit×100), 1/(limit×10)) → Light Blue • [1/(limit×10), 1/limit) → Blue • [1/limit, limit] → Default edge color (neutral) • (limit, limit×10) → Light Orange • [limit×10, limit×100) → Fluo Orange • [limit×100, +∞) → Fluo Red • CreateElbowConnector(PlanNode, PlanNode) now uses GetLinkColorBrush(PlanNode, double) instead of the static EdgeBrush, but only colors links differently for actual plans (estimated plans keep the default).
PR #289 Review — Features/colored linksOverviewAdds accuracy-ratio-based coloring to plan viewer connector lines (edges) on actual execution plans. Introduces a configurable What's good
Issues / suggestionsPerformance:
|
…e per node but only once
Highlights since v1.8.0: - Minimap for plan navigation (#276) - Colored links by accuracy ratio divergence (#289) - Distinct parallelism subtype icons (#285, #288) - Query Store filter ordering fix (#287) - xunit v2 -> v3 migration (#278) - SqlClient 6 -> 7, ScriptDom 170 -> 180 (#279) - System.CommandLine GA (#280) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
What does this PR do?
Accuracy-ratio colored links for plan viewer
Summary
Adds visual feedback on plan viewer links (edges) by coloring them according to the divergence between actual and estimated row counts. This helps immediately spot cardinality estimation issues in actual execution plans.
How it works
A new setting
accuracy_ratio_divergence_limit(default: 10) defines the neutral band. Links where the accuracy ratio (ActualRows / EstimateRows) falls between1/limitandlimitkeep the standard theme color. Outside that band, links are colored across 6 severity levels:[0, 1/(limit×100))[1/(limit×100), 1/(limit×10))[1/(limit×10), 1/limit)[1/limit, limit](limit, limit×10)[limit×10, limit×100)[limit×100, +∞)"Overestimation" = optimizer estimated more rows than actually produced; "Underestimation" = the opposite.
The coloring only activates on actual execution plans (where
HasActualStatsis true). Estimated plans are unaffected.Changes
AppSettingsService.csAccuracyRatioDivergenceLimitproperty toAppSettings(persisted asaccuracy_ratio_divergence_limit, default10).PlanViewerControl.axaml.csSolidColorBrushfields for link accuracy coloring (dark theme).GetLinkColorBrush(PlanNode, double)— maps a child node's accuracy ratio to the appropriate color band.RenderEdges/CreateElbowConnector— links now use accuracy-based coloring instead of the staticEdgeBrush.RenderMinimapEdges— minimap links use the same accuracy-based coloring.AccuracyRatioDivergenceLimitsetting instead of hardcoded10/0.1thresholds.≥ 2.0to prevent degenerate band boundaries.Not in scope
Index.razor) connector coloring — the web project still uses a static CSS class for links. This can be addressed in a follow-up.accuracy_ratio_divergence_limitsetting (currently requires manual edit ofappsettings.json).Testing
Which component(s) does this affect?
How was this tested?
Describe the testing you've done. Include:
Checklist
dotnet build -c Debug)dotnet test)