Understanding UNION and UNION ALL in SQL Server

  • Comments posted to this topic are about the item Understanding UNION and UNION ALL in SQL Server

  • Thank you for this clear write-up!

    😎

    There is one important thing to add, which is the difference in the difference in the implementation / execution of those two operators.

    UNION ALL implies a select operation from each table and then a set concatenation, UNION does the same with the addition of a DISTINCT SORT operator that is a blocking operation, can seriously affect performance on large data sets. The point here is NOT to use UNION but as for the last resort in deduplication the result sets, plenty of more efficient ways are available.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply