I am running into some performance issue and I have a query as follow:
SELECT * FROM Foo
UNION
SELECT * FROM Boo
UNION
SELECT * FROM Koo
I know for sure that Koo
is not returning any duplicates. I was considering to use UNION ALL
at the end and therefore save the sorting and distinct selection time for Koo
. The query should look like:
SELECT * FROM Foo
UNION
SELECT * FROM Boo
UNION ALL
SELECT * FROM Koo
Will that help or it will be affected bu the first UNION
?