Merge dev to main: sp_QuickieStore high-impact plan_count fix#794
Merged
Conversation
…orted+exception (#784) When @execution_type_desc = N'failed', the dynamic WHERE clause emits qsrs.execution_type_desc IN (N'aborted', N'exception') instead of the single-value parameter binding. Validation, RAISERROR text, and the parameter docs (description / valid inputs) updated accordingly. The three original values continue to use the existing parameterized = form. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The view-creation block stores each view's text as a binary literal in
#view_check.view_definition, then does a 3-way REPLACE to retarget it
to @output_database_name / @output_schema_name. The middle REPLACE was
searching for the bracketed form:
N'[dbo]' + '.' + QUOTENAME(vc.view_name)
But the stored view definitions were rewritten to the unbracketed form
("CREATE VIEW dbo.HumanEvents_Blocking ...") back in October 2023 and
the REPLACE search pattern was never updated to match. So for any
@output_schema_name other than 'dbo', the schema swap silently no-op'd
and the resulting CREATE/ALTER VIEW statement still referenced 'dbo',
which doesn't exist in the user's output database — leading to:
Msg 208, Level 16, State 6, Procedure HumanEvents_Blocking
Invalid object name 'dbo.HumanEvents_Blocking'.
Fix is one line: search for "dbo." + view_name (unbracketed) to match
what's actually in the stored definitions. View bodies don't contain
"dbo.<view_name>" anywhere else, so there's no collision risk.
Fixes #785
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
) (#787) The blocking-table INSERT's dynamic SQL had a leftover from the Sept 2024 "Cursor variables" refactor (9d3cff3) that switched column aliases from "expr AS alias" to "alias = expr". One column kept both forms: sqlhandle = CONVERT ( varbinary(64), bd.value(''(process/executionStack/frame/@sqLhandLe)[1]'', ...), 1 ) AS sqlhandle, T-SQL rejects the combination — you get "Incorrect syntax near the keyword 'AS'." on every blocking-table insert. This was masked by #785's schema-replace bug: anyone using a non-dbo @output_schema_name died at view creation before ever reaching the blocking-table INSERT. With that fixed in #786, the reporter advanced to this next error. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…_impact
In the @find_high_impact code path, plan_count and query_count were
sourced from #hi_query_stats, which only aggregates plans and queries
active within the analyzed time window. The adjacent plan_id_list and
query_id_list columns are built from the unfiltered #hi_id_staging_*
tables (all-time), so any query_hash with retired plans showed a
plan_count lower than the number of IDs listed.
The help text documents both columns as all-time totals ("across all
variants" / "share this hash"). Source the displayed plan_count and
query_count from #hi_id_staging_plans and #hi_id_staging_queries so
they match their _id_list counterparts. The window-scoped
#hi_query_stats.plan_count is retained for the in-window plan
instability diagnostics.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…pact-plan-count sp_QuickieStore: fix plan_count/query_count under-count in @find_high_impact
Resolves an add/add conflict in Presentations/Row Goals/Row Goals.sql (whitespace/BOM only) in favor of main's version, which matches the repo's no-BOM convention. sp_QuickieStore.sql and DarlingData.sql auto-merged. Co-Authored-By: Claude Opus 4.7 (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.
Promotes
devtomain.Includes the fix for
sp_QuickieStore@find_high_impactunder-countingplan_count/query_count(#793), plus priordevcommits.🤖 Generated with Claude Code