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
C6 — external-wait benefit formula:
The existing parallel-wait formula uses per-thread wait = max(0, elapsed - cpu).
External / preemptive waits (MEMORY_ALLOCATION_EXT, RESERVED_MEMORY_ALLOCATION_EXT,
PREEMPTIVE_*) are CPU-busy in kernel, so elapsed ≈ cpu for those threads and the
wait barely shows in that math. Joe's formula:
wait_cpu_share = wait_ms / total_cpu_ms
sum_max_cpu = Σ max-thread-self-cpu across operators
benefit_ms = wait_cpu_share * sum_max_cpu
Verified against Joe's worked example on MwX36LEHJS:
(26307 / 45075) * (11341 + 42) / 13748 = 48.3% ✓
Implementation:
- New IsExternalWait classifier (public so mapping can see it) covering
MEMORY_ALLOCATION* and PREEMPTIVE_* prefixes.
- OperatorWaitProfile grows MaxThreadCpuMs — per-thread self-CPU
(non-cumulative), taken from new PlanAnalyzer.GetOperatorMaxThreadOwnCpuMs
which mirrors GetOperatorOwnElapsedMs. Uses self-CPU so summing across
operators in a serial plan doesn't double-count cumulative CPU, and
sums to approximate critical-path CPU in parallel plans.
- ScoreWaitStats routes external waits to CalculateExternalWaitBenefit.
- Serial plans with external waits: sum-of-self-cpu ≈ statement cpu, so
the formula collapses to wait/elapsed — same as before, no regression.
C7 — CPU:Elapsed numerator:
External waits inflate the CPU number without representing real query CPU,
so the CPU:Elapsed ratio (used in web runtime card, HTML export runtime
card, and Avalonia DOP efficiency) subtracts Σ external-wait ms from CPU
before dividing by elapsed.
- AnalysisResult.QueryTimeResult gains ExternalWaitMs, populated in
ResultMapper by summing wait stats matching IsExternalWait.
- HtmlExporter.WriteRuntimeCard, Index.razor runtime card, and
PlanViewerControl DOP-efficiency calc all use (cpu - externalWaitMs).
Version bump 1.7.3 -> 1.7.4.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments