Skip to content

sp_QuickieStore: use EXISTS in final plan OUTER APPLY#714

Merged
erikdarlingdata merged 1 commit intodevfrom
fix/hi-exists-plan-apply
Mar 24, 2026
Merged

sp_QuickieStore: use EXISTS in final plan OUTER APPLY#714
erikdarlingdata merged 1 commit intodevfrom
fix/hi-exists-plan-apply

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

Replaced JOIN to #hi_id_staging_plans with EXISTS semi-join in the final OUTER APPLY. The optimizer picks a better plan with the EXISTS pattern.

🤖 Generated with Claude Code

The JOIN pattern in the OUTER APPLY wasn't getting a good plan.
EXISTS with the semi-join against #hi_id_staging_plans lets the
optimizer pick a better strategy for the correlated subquery.

Tested on SQL2022.

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