Add wait stats as cross-cutting analysis signal#216
Merged
erikdarlingdata merged 2 commits intodevfrom Apr 10, 2026
Merged
Conversation
Surface statement-level wait stats across Rules 1, 5, 11, and 16 so the analyzer uses actual execution wait evidence to enrich warnings. The dominant wait type (SOS_SCHEDULER_YIELD, CXPACKET, HTBUILD, PAGEIOLATCH, LCK_M_S, etc.) is appended to each warning message. Rule 11 (Scan with Predicate) additionally elevates to Critical when I/O waits confirm the scan is hitting disk at >= 50% of plan cost. Expand GetWaitStatsAdvice (Rules 25/31) with specific explanations for all 21 wait types found in real plan files: SOS_SCHEDULER_YIELD, CXSYNC_PORT, MEMORY_ALLOCATION_EXT, HTBUILD/HTDELETE/HTREPARTITION, BPSORT, BMPBUILD, PAGELATCH, LOGBUFFER, ASYNC_NETWORK_IO, SOS_PHYS_PAGE_CACHE, and others. Remove dead RESOURCE_SEMAPHORE branch (pre-execution wait, never appears in statement-level plan wait stats). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Annotate each wait stat line in the advice panel with a short description (e.g., "I/O — reading data from disk", "CPU — scheduler yielding") so users can immediately understand what each wait type means without leaving the panel. Labels render inline in muted text via GetWaitLabel(). Extract DescribeWaitType() from GetWaitStatsAdvice() so the wait type knowledge is reusable. Remove dead RESOURCE_SEMAPHORE branch (pre-execution wait, never appears in plan wait stats). Drop the separate summary line that had formatting issues in favor of per-line inline labels. Co-Authored-By: Claude Opus 4.6 (1M context) <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
GetWaitStatsAdvice(Rules 25/31) with specific explanations for all 21 wait types found in real plan files: SOS_SCHEDULER_YIELD, CXSYNC_PORT, MEMORY_ALLOCATION_EXT, HTBUILD/HTDELETE/HTREPARTITION, BPSORT, BMPBUILD, PAGELATCH, LOGBUFFER, ASYNC_NETWORK_IO, SOS_PHYS_PAGE_CACHETest plan
join_or_clause_plan.sqlplan— inline labels appear for all 8 wait types.internal/examplesthat have diverse wait profiles🤖 Generated with Claude Code