Repository navigation
Fix the plan shape described for the optional parameter pattern - #10492
Open
Rudi Bruchez (rudi-bruchez) wants to merge 1 commit into
Open
Rudi Bruchez (rudi-bruchez) wants to merge 1 commit into
Rudi Bruchez (rudi-bruchez) wants to merge 1 commit into
Conversation
prmerger-automator
Bot
requested review from
Van To (VanMSFT) and
Derek Wilson (thesqlsith)
November 11, 2026 05:23
Contributor
|
Rudi Bruchez (@rudi-bruchez) : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
Contributor
|
Rudi Bruchez (@rudi-bruchez) : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
Contributor
|
Learn Build status updates of commit 3165082: ✅ Validation status: passed
For more details, please refer to the build report. |
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's wrong
In "Supported query patterns", the page says the optimizer can't seek on the index on the
bedroomscolumn because a seek isn't valid when@bedroomsisNULL, then ends with:Without OPPO, the generated plan does scan that index, which is what the previous sentence leads to.
Evidence
SQL Server 2025 CU10 (17.0.5035.5), Developer edition, Linux container. Fresh database, 200,000 rows, nonclustered index on
bedrooms.Observed with OPPO off at compatibility level 170, and at levels 160 and 150 where OPPO doesn't apply: one plan for both parameter values, Nested Loops over an Index Scan of
ix_bedroomswith a Clustered Index Seek (a coveringSELECT id, bedroomsgives an Index Scan ofix_bedroomsalone). With OPPO on at level 170: two variants, an Index Seek ofix_bedroomsfor@bedrooms = 10and a scan forNULL, as the rest of the page describes.Expected per the current text: no scan of the index.
Change
"doesn't include" becomes "includes" in that sentence.