I have a very large query with three UNION ALL and it takes 30 minutes to execute.
Analyzing the execution plan I see that it has a high cost in SORT and Filter.
I tried to generate the showplan in XML but it's more than 2MB.
I put the complete query in OneDriver because it has 104364 characters
Could someone help me to improve the execution time of the query?
Thanks.