Skip to content

Merge dev to main: sp_QuickieStore high-impact plan_count fix#794

Merged
erikdarlingdata merged 7 commits into
mainfrom
dev
May 21, 2026
Merged

Merge dev to main: sp_QuickieStore high-impact plan_count fix#794
erikdarlingdata merged 7 commits into
mainfrom
dev

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Promotes dev to main.

Includes the fix for sp_QuickieStore @find_high_impact under-counting plan_count / query_count (#793), plus prior dev commits.

🤖 Generated with Claude Code

erikdarlingdata and others added 7 commits May 12, 2026 04:16
…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>
@erikdarlingdata erikdarlingdata merged commit cead18b into main May 21, 2026
9 checks passed
erikdarlingdata added a commit that referenced this pull request May 23, 2026
Picks up cead18b (PR #794 merge) and cea63fe (auto-rebuilt Install-All)
so the upcoming dev->main PR only contains the new ProtectSession files
and does not inadvertently revert the Install-All rebuild.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant