I am going to use hint OPTION (RECOMPILE) or OPTION (OPTIMIZE FOR UNKNOWN) at the end of query in my sp.Query contains union all operator so shall i use cte?will it improve or affect the performance?.suggest please.
Example
;with cte
{
QUERY 1
UNION ALL
QUERY 2
}
select * from cte OPTION (RECOMPILE);