Developers absolutely love DISTINCT don’t they? They use them everywhere but often for the wrong reasons. My current pet hate in this area is DISTINCT in UNIONs. I’m guessing they:
- Don’t realise UNION will give them the DISTINCT list
- Somehow believe DISTINCT in that part of the UNION will make the statement miraculously faster
None of which are necessarily true – in fact the addition of a DISTINCT can adversely affect execution plans in some cases.