Merge Transformation Vs Union All Transformation

Difference between merge and Union All transformation

  1. Merge transformation requires sorted input to process data but union all does not need any sorted input.
  2. Union All is always faster than merge transformation
  3. Merge allows only two inputs but union all allows more than two inputs.
  4. Merge do not allow single input but union all allows single input.
  5. Both the transformation are considered as semi blocking
  6. Both transformations allow duplicate outputs.

Performance consideration while using merge transformation

If you have a scenario where you need to have sorted output then do not use sort transformation rather use sorting at source query preferably ORDER BY if you are using T-SQL.

If you feel that sorting is not required in your use case then Union All is the preferable transformation over Merge.



No comments:

Post a Comment

T-SQL LEAD LAG and SUM function based query

  Query on T-SQL window clause Below is the sales table Order_Date Name Product SubCategory ...