I *HAD* too read the postgresql documentation on SELECT which clearly states that:
The result of UNION does not contain any duplicate rows unless the ALL option is specified. ALL prevents elimination of duplicates. (Therefore, UNION ALL is usually significantly quicker than UNION; use ALL when you can.).
But clearly I hadn't internalized it and continued preferring UNION because it was one word instead of two :-).
The bug report set me straight though. Now I will *definitely* remember the difference between UNION and UNION ALL (in that UNION folds duplicate rows into just one).
No comments:
Post a Comment