Make the node row label agree with its percentage - #615
Merged
Merged
Conversation
The label printed both row counts N0 but took the percentage from the unrounded values, so a Key Lookup that ran 117 times for 1 row read "1 of 1 (89%)". PlanRowAccuracy, ported from PerformanceMonitor's PlanRowAccuracy (#4684), adds the fewest decimals (up to 4, fixed-point) at which the printed numbers give the printed percentage, and never prints a non-zero value as 0. That label now reads "1 of 1.128 (89%)". The App and Web node labels and the HTML export all use it, so all three print the same numbers, and PerformanceMonitor prints the same string for the same plan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019tS6P95Dtzs4aeMpb1xqzX
1 task
|
Reviewed the diff. I found nothing blocking.
Minor, non-blocking: |
This was referenced Sep 29, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
N0but took the percentage from the unrounded values. When rounding moved a number, the label contradicted its own percentage. A Key Lookup that ran 117 times for 1 row read "1 of 1 (89%)".PlanRowAccuracyclass applies the rule from the issue. It printsN0first. If the whole percent of the printed numbers differs from the printed percentage, it adds the fewest decimals at which they agree, up to 4. It never prints a non-zero value as 0. That label now reads "1 of 1.128 (89%)".PlanRowAccuracy(Plan viewer: a screen-reader select on the + tab adds one sub-tab, and a row label under 1 agrees with its percentage (#4684) PerformanceMonitor#4688 and Plan viewer and analyzer: compare row estimates the way PerformanceStudio does (#4627 follow-up) PerformanceMonitor#4698), so both apps print the same string for the same plan.Closes #611
Changes
src/PlanViewer.Core/Services/PlanRowAccuracy.cs(new):FormatActualOfExpectedreturns the whole label.PrintActualOfExpectedreturns the two numbers and the percentage, for a surface that words the label differently.src/PlanViewer.App/Controls/PlanViewerControl.Rendering.csandsrc/PlanViewer.Web/Pages/Index.razor: the App and Web node labels useFormatActualOfExpected. The label color does not change.src/PlanViewer.Core/Output/HtmlExporter.cs: the HTML export usesPrintActualOfExpectedand keeps its "X of Y rows (P%)" wording.src/PlanViewer.Web/PlanViewer.Web.csproj: links the new Core file, because the Web project compiles Core sources directly.tests/PlanViewer.Core.Tests/PlanRowAccuracyTests.cs(new): PerformanceMonitor's rule cases and its 2,000-pair sweep, the issue's examples, and the App label and the HTML export forkey_lookup_plan.sqlplan. It also checks the source of the Web label, because the test project does not reference the Web project and cannot render that label.Test Plan
PlanRowAccuracyTests,NodeLabelRowAccuracyTestsandHtmlExporterTestspass on this branch (56 tests).tests/PlanViewer.Core.Tests/Plans/key_lookup_plan.sqlplan. The Key Lookup's label reads "1 of 1.128 (89%)".Generated with Claude Code
https://claude.ai/code/session_019tS6P95Dtzs4aeMpb1xqzX