After our SQL Server upgraded from 2012 to 2014, some stored procedure's performance has decreased.
We found that query hint can be used to solve this problem, however I wonder how can we add query hint in a SQL of following structure:
INSERT INTO TABLE1 ....
SELECT ...
FROM TABLE2
--OPTION (QUERYTRACEON 9481)
If I simply add it at the end of the snippet (the commented line), is it affecting the SELECT
query, the INSERT
query, or both? How about if I would like to use query hint on SELECT
or INSERT
only?