Skip to content

sp_QuickieStore: add clustered PKs to @find_high_impact temp tables#717

Merged
erikdarlingdata merged 1 commit intodevfrom
fix/hi-clustered-pks
Mar 24, 2026
Merged

sp_QuickieStore: add clustered PKs to @find_high_impact temp tables#717
erikdarlingdata merged 1 commit intodevfrom
fix/hi-clustered-pks

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

Adds clustered primary keys to 7 temp tables with clear unique keys to help the optimizer with join strategies and cardinality estimates.

Test plan

  • SQL2022 — clean, same results
  • SQL2016 — clean, same results

🤖 Generated with Claude Code

Adds clustered primary keys to 7 temp tables to give the optimizer
better cardinality and join strategy information:
- #hi_plan_stats (plan_id)
- #hi_query_stats (query_hash)
- #hi_interesting (query_hash)
- #hi_primary_window (query_hash)
- #hi_query_waits (query_hash)
- #hi_query_identifiers (query_hash)
- #hi_output (query_hash)

Tables without PKs are those with composite keys or multiple rows per
hash (staging tables, time_buckets, wait_staging, representative_text).

Tested on SQL2022 and SQL2016.

Co-Authored-By: Claude Opus 4.6 (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