To get the same results as your query above, you can do this:
SELECT COALESCE(ac, bc) AS c FROM a FULL OUTER JOIN b ON bc = ac
However, this will give you the same results as UNION, which is not quite the same as UNION ALL (since duplicates will be deleted). To execute UNION all, you will need to do the same, but the join condition will not be fulfilled:
SELECT COALESCE(ac, bc) AS c FROM a FULL OUTER JOIN b ON 1 = 0
In any case, I'm not sure if it will be much faster than using UNION.
source share