UNION Vs UNION ALL

Started by VelMurugan, Jan 27, 2009, 05:17 PM

Previous topic - Next topic

VelMurugan

UNION Vs UNION ALL

You should use UNION ALL instead of UNION if there is no need to eliminate duplicate result rows from the result sets being combined with the UNION operator.

The UNION statement has to combine the result sets into a worktable to remove any duplicate rows from the result set.

UNION ALL simply concatenates the result sets together, without the overhead of putting them into a worktable to remove duplicate rows.



Source : sqlthegreat