You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The benefit for external and preemptive waits is far too low (MEMORY_ALLOCATION_EXT, PREEMPTIVE_*) #4517
Part of #4511, the sync of plan analysis changes from PerformanceStudio (PS) to PerformanceMonitor (PM). Port together with #4516.
Summary
ScoreWaitStats (BenefitScorer.cs:450) scores each wait from each thread's elapsed time minus its CPU time. External and preemptive waits keep the thread busy on CPU in the kernel. For those threads, elapsed time is about equal to CPU time, so these waits barely show in that math. The affected waits are MEMORY_ALLOCATION_EXT, RESERVED_MEMORY_ALLOCATION_EXT and the PREEMPTIVE_* waits.
PerformanceStudio
erikdarlingdata/PerformanceStudio@6b61d79 adds IsExternalWait for the MEMORY_ALLOCATION* and PREEMPTIVE_* prefixes. It scores these waits with a separate formula. The formula multiplies the wait's share of total CPU time by the sum of each operator's maximum per-thread CPU time. It then divides by the elapsed time. In the worked example in that commit, the formula gives 48.3%.
Port
PM has no IsExternalWait, no formula for external waits, and no helper for the maximum per-thread CPU time of an operator. PS added that helper, GetOperatorMaxThreadOwnCpuMs, next to GetOperatorOwnElapsedMs (PlanAnalyzer.cs:1387 in PM). Size M.
At 1899737f. dev has no later change to PerformanceMonitor.PlanAnalysis.
Fixed by #4555 (0cb8d87), so this issue is closing. External and preemptive waits get PerformanceStudio's separate benefit formula instead of being folded into operator time.
Activity
External and preemptive waits get a real benefit formula (#4517)
Plan analysis: wait stats become findings, and external and preemptiv…
erikdarlingdata commentedon Sep 28, 2026
Closed by the watcher: delivered in PR #4555, merged to dev.
erikdarlingdata commentedon Sep 28, 2026
Claude posting for Erik Darling.
Fixed by #4555 (0cb8d87), so this issue is closing. External and preemptive waits get PerformanceStudio's separate benefit formula instead of being folded into operator time.