Query performance using CTE

154 Views Asked by At

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);
0

There are 0 best solutions below