New Official Documentation on Forced Parameterization

Execution Plans
5 Comments

I love me some documentation.

For years, I’ve pointed folks to the SQL Server 2008 documentation on Forced Parameterization, a really useful tool for reducing plan cache bloat, getting more accurate reusable query plans, and enabling SQL Server 2019 and 2022’s Intelligent Query Plan features, many of which rely on the same query text coming in repeatedly over time in order to tune it. That documentation was pretty sparse, though.

Good news! There’s a new set of documentation on Forced Parameterization, and it goes into more details about:

  • What kinds of literals are converted into parameters
  • The exceptions: things you would expect to get converted, but won’t be, and will stop the whole statement from getting parameterized at all
  • The partial-parameterization exceptions: things that won’t get converted, but other stuff in the query still will, leading the plan cache to continue to be a hot mess and stopping the IQP features from working on those queries

There’s also a foreboding warning:

Danger

At first blush, that sounds completely reasonable, but it carries a hidden connotation. If you’re using Query Store, and you expect the forced query to remain the same from patch to patch or version to version, it might not. I’ve never actually seen these things change, but Microsoft is saying they could, which is just another heads-up that forced query plans may not be forced anymore after a change like that. This might have even always been in the old docs – I just never noticed it before. Still, it seems reasonable to me. I’d love to see more investments in Forced Parameterization.

Also, technically, we don’t have Service Packs anymore, so I was a good community member and submitted a pull request to change that wording to Cumulative Updates. As a reminder, when you see a typo or outdated language in the docs, you can click the little three-dot icon at the top right, then click Edit, and you’ll be shoved over to Github to edit there and submit a pull request:

By the power of Graybeard

If you’ve never used Github before, the process is intimidating at first, but once you get used to it, it’s a piece of cake and you can submit edits in less than 30 seconds.

Previous Post
It’s Our Anniversary! Let’s Have a Sale!

5 Comments. Leave new

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.