Fix OverflowException on wait stats decimal division (Issue #395)#396
Merged
erikdarlingdata merged 2 commits intodevfrom Mar 3, 2026
Merged
Fix OverflowException on wait stats decimal division (Issue #395)#396erikdarlingdata merged 2 commits intodevfrom
erikdarlingdata merged 2 commits intodevfrom
Conversation
…395 SQL Server's decimal arithmetic produces decimal(38,24) when dividing decimal(19,4) by bigint, which exceeds .NET System.Decimal's ~29 digit limit. Wrap all 20 per-second rate and avg-ms-per-wait division results in CAST(... AS decimal(18, 4)) to bound the result type. Affects wait stats, signal wait stats, lock wait stats, and execution count per-second calculations. Closes #395 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Same decimal(19,2) / bigint => decimal(38,21) overflow risk in the poison wait delta query used by the Server Health Overview page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
decimal(38,24)when dividingdecimal(19,4)bybigint, exceeding .NET'sSystem.Decimal~29-digit limitCAST(... AS decimal(18, 4))to bound the result typeXTP_PREEMPTIVE_TASK(227M ms wait time)Files changed
Dashboard/Services/DatabaseService.ResourceMetrics.cs(16 instances)Dashboard/Services/DatabaseService.QueryPerformance.cs(4 instances)Test plan
Closes #395
🤖 Generated with Claude Code