union all vs union

UNION ALL vs UNION Oracle PL/SQL

Difference between UNION ALL and UNION in Oracle

UNION

In Oracle the UNION clause delays returning any rows until each portion of the UNION is sorted and merged and duplicates filtered out.

 

UNION ALL

A UNION ALL  simply returns all rows with out the overhead of sorting, merging and removing duplicates from the results. If you don’t care about duplicates or the tables are mutually exclusive you can use UNION ALL  to increase performance of the query.

If performance is more important than the duplicates than UNION ALL  will speed up the query, otherwise stick with UNION .

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here : *

Reload Image