When trying to find duplicates on an table how I need to know how index the
table to optimize performance.
Should there be an index for each attribute (A1, A2, ..., An) in the GROUP
BY or should there be one multi-attribute index on all the grouping
attributes.
Assume the table has more attributes than those attributes being GROUPed on.
Also, assume all attributes are of type varchar.
Sample query to return non-uniqueness
SELECT A1, A2, A3, ..., An
FROM Table
GROUP BY A1, A2, A3, ..., An
HAVING Count(*)>1