Commit a08cdb3
Collapse per-metric totals in sp_QuickieCache into a resource_metrics XML column
Mirrors the compact XML rollup just added to sp_QuickieStore @find_high_impact.
Twelve individual columns (total_cpu_ms, total_duration_ms, total_physical_reads,
total_logical_writes, total_grant_mb, total_spills, max_grant_mb,
max_used_grant_mb, max_spills, max_dop, min_rows, max_rows) are replaced
with a single clickable resource_metrics xml column in the main result
set. Built during the #scored insert using FOR XML PATH(N'metrics'), TYPE
with attribute-path aliases — native xml, no STRING_AGG and no string
concatenation.
avg_* attributes are computed inline as total / NULLIF(total_executions, 0)
and surface per-execution metrics that previously weren't exposed anywhere
in the output.
Shape:
<metrics>
<cpu total_ms avg_ms min_ms max_ms/>
<duration total_ms avg_ms min_ms max_ms/>
<physical_reads total avg min max/>
<logical_writes total avg/>
<rows total avg min max/>
<grant total_mb avg_mb max_mb/>
<used_grant total_mb avg_mb max_mb/>
<spills total avg max/>
<executions total/>
<parallelism max_dop/>
</metrics>
No time-of-day / primary_window filter here (unlike sp_QuickieStore) — the
plan cache DMVs don't carry per-interval execution metadata, so there's
nothing to classify Business / Off-hours / Weekend activity against.
Share columns (cpu_share, duration_share, etc.) remain as dedicated
sortable columns.
Smoke-tested on sql2022: installed cleanly, ran end-to-end, resource_metrics
is well-formed XML with all expected child elements.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3e168e6 commit a08cdb3
1 file changed
Lines changed: 43 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1736 | 1736 | | |
1737 | 1737 | | |
1738 | 1738 | | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
1739 | 1742 | | |
1740 | 1743 | | |
1741 | 1744 | | |
| |||
1792 | 1795 | | |
1793 | 1796 | | |
1794 | 1797 | | |
| 1798 | + | |
1795 | 1799 | | |
1796 | 1800 | | |
1797 | 1801 | | |
| |||
1955 | 1959 | | |
1956 | 1960 | | |
1957 | 1961 | | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
1958 | 2000 | | |
1959 | 2001 | | |
1960 | 2002 | | |
| |||
2338 | 2380 | | |
2339 | 2381 | | |
2340 | 2382 | | |
2341 | | - | |
2342 | | - | |
2343 | | - | |
2344 | | - | |
2345 | | - | |
2346 | | - | |
2347 | | - | |
2348 | | - | |
2349 | | - | |
2350 | | - | |
2351 | | - | |
2352 | | - | |
| 2383 | + | |
2353 | 2384 | | |
2354 | 2385 | | |
2355 | 2386 | | |
| |||
0 commit comments