Created
October 17, 2024 20:58
-
-
Save JosiahSiegel/9a760130e722c153c01819124518887a to your computer and use it in GitHub Desktop.
Force hint on query in query store
This file contains 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
-- get query id | |
SELECT | |
q.query_id, | |
qt.query_sql_text | |
FROM sys.query_store_query_text qt | |
INNER JOIN sys.query_store_query q ON | |
qt.query_text_id = q.query_text_id | |
WHERE query_sql_text like N'%select column from table%' | |
GO | |
-- set query hint | |
EXEC sys.sp_query_store_set_hints @query_id= 888, @query_hints = N'OPTION(USE HINT(''ENABLE_PARALLEL_PLAN_PREFERENCE''))'; | |
-- view query hints | |
SELECT * | |
FROM sys.query_store_query_hints | |
-- remove query hints | |
EXEC sys.sp_query_store_clear_hints @query_id = 888; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment