I know that UNION ALL supposed to have better performance than UNION (see: performance of union versus union all).
Now, I have this huge stored procedure (with a lot of queries), where The final result is a two section SELECT with a UNION between them. Since both data sets are foreign for each other, I can use UNION ALL which suppose to be better (no distinct operation).
I've check it on several databases and it worked fine. The problem is that one of my customers give me his database for performance tuning, and when I investigated it I noticed that if I'm changing the UNION ALL to UNION the performance is a bit better(!). This is all the change I've done in the stored procedure.
Can someone please explain how this situation can occur???
Thanks,
Ziv
Update:
attached execution plan of both queries (the diff part):