sp_QuickieStore: @find_parameter_sensitive fixes from prod dogfooding - #854
Open
erikdarlingdata wants to merge 3 commits into
Open
sp_QuickieStore: @find_parameter_sensitive fixes from prod dogfooding#854erikdarlingdata wants to merge 3 commits into
erikdarlingdata wants to merge 3 commits into
Conversation
Five changes driven by running the mode against a busy 11-database fleet: - Work-weight the ranking: coefficient of variation alone is scale-blind, so a 3ms query swinging to 60ms outranked a 2s query swinging to 40s. Selection and presentation now rank on volatility * LOG10(10 + total work in the window for the ranked metric). On quiet systems the weight is near-uniform and behavior is effectively unchanged; on busy systems a shape must be both volatile and expensive to surface. The volatility_score column still shows the raw coefficient of variation; ranked_on says 'work-weighted' so the output describes itself. - Honor the hash-based include/ignore lists: shapes are keyed by query_hash + query_plan_hash, so the lists map directly. Parsed locally in the mode block (the main filter section is never reached), filtered in step 3 before the top-N cut. In the fleet run an index-maintenance query burned a top-15 slot on 5 of 11 databases with no way to exclude it across runs. - Close the signals classification gap: cpu_ratio >= 20 that fails both the parameter-sensitive test (>= 10x rows ratio) and the row-driven test (<= 2x rows ratio) previously produced no verdict at all; those shapes now read 'mixed swings (cpu Nx, rows Nx)'. - Cap displayed ratios at 9999+ (floored mins produced values like 'cpu 2850350x', which stops carrying information) and render zero-row shapes as 'rows flat' instead of 'rows 0x'. - Explain top_waits availability in the shape volatility summary: the column is silently omitted when wait stats capture is off or pre-2017, which is easy to misread as no waits; a wait_stats summary column now says which case applies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…t_stats summary in @find_parameter_sensitive Nine new assertions: bidirectional hash include/ignore proof against the sniffed shape's actual query_hash value in detail rows (ignore removes it, include keeps only it, a hash nobody has returns zero shapes with the summary as positive control), ranked_on carries the work-weighted marker, the summary explains top_waits availability, and the internal sort_value column does not leak into output. 166 total. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Install-All/DarlingData.sql is only regenerated and committed on main, because rebuilding it on dev made every dev -> main merge conflict inside the generated 2+ MB file. That leaves dev's tracked copy stale: the two sp_QuickieStore wait-accounting fixes merged 8/04 were not in any compiled build until release. This workflow compiles Install-All on every dev push that touches SQL and publishes it as an asset on a rolling 'dev-latest' prerelease. Nothing is committed to the branch, so merges never see the file change, and a fresh dev build is always one download away: gh release download dev-latest -p DarlingData.sql -R erikdarlingdata/DarlingData Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Claude finished @erikdarlingdata's task in 4m 18s —— View job Review: PR #854 —
|
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.
What
Five changes to
@find_parameter_sensitive, all driven by dogfooding the mode against an 11-database production fleet (SQL Server 2019/2022 on RDS, Query Store catalogs with 4K–15K plan shapes per 72h window), plus a CI workflow that gives dev a fresh compiled Install-All without recreating the old merge-conflict problem.1. Work-weighted ranking
Coefficient of variation alone is scale-blind: in the fleet run, sub-1s-max-CPU shapes held 91 of 162 top-15 slots because a 3ms→60ms swing out-CoVs a 2s→40s one. Selection and presentation now rank on
volatility * LOG10(10 + total work in the window for the ranked metric). On quiet systems the weight is near-uniform (log of tiny totals ≈ 1) so behavior is effectively unchanged; on busy systems a shape must be both volatile and expensive.volatility_scorestill shows the raw CoV;ranked_onsayswork-weightedso output describes itself. The internalsort_valuecolumn stays internal (test asserts it doesn't leak).Prod evidence (same params, same fleet, old vs. patched build side by side): window CPU represented by the surfaced top-15 rose from 295s → 4,170s on one tenant and 829s → 2,884s on another, with only 2–4 swaps per database — the swapped-in shapes included a 3,507 CPU-s parameter-sensitive adhoc (96K execs) and a 2,177 CPU-s shape (461K execs) that pure CoV had ranked below sub-second queries.
2. Hash-based include/ignore lists are honored
Shapes are keyed by
query_hash + query_plan_hash, so@include_query_hashes/@ignore_query_hashes/@include_plan_hashes/@ignore_plan_hashesmap directly. They're parsed locally in the mode block (the main filter section is never reached from the takeover mode) and filter in step 3, before the top-N cut. Motivation: an index-maintenance frag query occupied a top-15 slot on 11 of 11 production databases in both runs — it's genuinely volatile and expensive, so no honest ranking can drop it, and there was previously no way to exclude it. With@ignore_query_hashesit disappears on 11/11 (verified live).3.
mixed swingssignal closes the classification gapcpu_ratio >= 20that fails both the parameter-sensitive test (>= 10xrows ratio) and the row-driven test (<= 2xrows ratio) previously produced no verdict at all — 25 of 162 surfaced shapes in the fleet run had a blank signals column, which reads as "nothing to see" on a row the mode itself just ranked top-15.4. Ratio display caps
Floored mins produced
cpu 2850350x, which stops carrying information; displays now cap at9999+, and shapes that never returned a row readrows flatinstead ofrows 0x.5.
wait_statscolumn in the shape volatility summarytop_waitsis silently omitted when wait stats capture is off (or pre-2017) — easy to misread as "no waits" (only 1 of the 11 prod databases had capture on, and the silent omission fooled the harness that found these issues). The summary now says which case applies, verified live on both a capture-on and capture-off database.CI: rolling dev Install-All build (separable — happy to drop from this PR)
Install-All is intentionally only regenerated on main because dev rebuilds made every dev→main merge conflict inside the generated 2+ MB file. The new
dev-installall-artifact.ymlcompiles it on dev pushes and publishes to a rollingdev-latestprerelease asset — nothing is ever committed to the branch, so merges stay clean, and a current dev build isgh release download dev-latest -p DarlingData.sqlaway. Context: the two wait-accounting fixes merged 8/04 weren't in any compiled build, which forced a manual overlay when updating a 54-instance fleet this week.Tests
sp_QuickieStore/tests/run_tests.py: 157 → 166 passing (SQL Server 2022 container). New assertions: bidirectional hash include/ignore proof against the sniffed shape's actualquery_hashvalue in detail rows, work-weightedranked_onmarker,wait_statssummary presence, and asort_valueno-leak guard.Harness portability note observed while testing: classic ODBC
sqlcmd(17.x, macOS homebrewmssql-tools) rejects the harness's-W -y 200flag pair as mutually exclusive; go-sqlcmd (what CI installs) accepts it. Ran locally withSQLCMD_BINpointed at go-sqlcmd v1.10.0. Left as-is, flagging in case a follow-up portability tweak is wanted.🤖 Generated with Claude Code