I have a query that uses 4 union all Statements.
The 5 queries are all same except the filters are different
Individually run ,each takes sub seconds to run , but when run in an union it takes over 20Seconds.
Any suggestions on how to reduce the the execution time for such query