SQL-Server-First-Responder-Kit icon indicating copy to clipboard operation
SQL-Server-First-Responder-Kit copied to clipboard

sp_BlitzQueryStore Should Have an Ignore List, Like sp_Blitz's @IgnorePrioritiesAbove

Open ReeceGoding opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I find that the "Unparameterized Query" warning in sp_BlitzQueryStore is useless. I have never encountered a case where it flags up for a query that I would want to parameterize. I'm sure that other people find it useful (it's been in sp_BlitzCache for a very long time), but it never has been for me. I would like a way to make sp_BlitzQueryStore skip certain checks, similar to sp_Blitz's @IgnorePrioritiesAbove parameter.

Describe the solution you'd like Copying sp_Blitz's @IgnorePrioritiesAbove parameter and its functionality would work, but a better idea may be to have a sp_Blitz's @IgnorePriorities parameter that takes in a collection of integers and skips any checks with priorities matching those integers. If you are in a version that supports Query Store, then you certainly have both table-valued parameters and string_split (unless there's something weird going on with compatibility levels, I think?). Either could be used to pass a collection of integers in to sp_BlitzQueryStore.

Describe alternatives you've considered "Unparameterized Query" isn't the only warning that I've found no use for, but it's been so useless to me that I originally came here to argue that it should be removed entirely. I've since ruled that out, but I'm still curious to hear from people who have found it useful.

Are you ready to build the code for the feature? I could probably do it, but I'd like to see what people think before I start writing any code.

ReeceGoding avatar Feb 17 '24 15:02 ReeceGoding

Sure, if you want to add this, for consistency, let's use the same @IgnorePrioritiesBelow INT and @IgnorePrioritiesAbove INT parameters that sp_Blitz uses. (When adding new functionality, we try to keep it the same as other scripts in the kit for easier end user experience.)

Or, if you want to skip specific checks, you can use sp_Blitz's @SkipChecks parameters. Those involve setting up a temp table with a list of checks that you want to skip. That code is significantly harder to write since you have to frame every check with a temp table query like this:

				IF NOT EXISTS ( SELECT  1
								FROM    #SkipChecks
								WHERE   DatabaseName IS NULL AND CheckID = 2 )
					BEGIN

But it's really powerful & flexible.

BrentOzar avatar Feb 18 '24 12:02 BrentOzar

@ReeceGoding it's been a couple of months - I'm going to go ahead and close this for now, but whenever you'd like to add that functionality, feel free to submit a pull request and we can go from there. Thanks!

BrentOzar avatar Apr 19 '24 15:04 BrentOzar