Union vs. Union All in Oracle

  • UNION eliminates any duplicate rows
  • UNION ALL returns all rows including duplicate values
  • UNION ALL is faster than UNION; Union’s duplicate elimination requires a sorting operation which takes time.
  • Example 
          SELECT * FROM table_A
       UNION ALL 

      SELECT * FROM table_B;



No comments:

Post a Comment