Welcome Guest. Sign in or Signup

1 Answers

Union vs Union All

Asked by: 3036 views SQL

It’s not uncommon to see two or more queries combined using a Union or Union All. Can you explain how does Union differ from Union All? Which one is faster and why?

Related Questions

1 Answers

  1. candidate on May 12, 2012 Reply

    Union produces a union of the results of the two or more queries that are combined. That is, there will not be aby duplicates in the results. However, a Union All retains all rows of data from all the queries that are combined.

    So obviously, the UNION ALL will be much faster than the UNION as the former doesn’t have any overhead for sorting and removing duplicates.

    0 Votes Thumb up 0 Votes Thumb down 0 Votes

Answer Question