I have a query that I use for finding duplicate data. I have found that lately the query is very slow, and only getting slower. This is the query I am using (columns renamed):
SELECT col1,
COUNT(col1) AS Counter
FROM people
GROUP BY col1
HAVING (Counter > 1)
I have indexed col1 (which is a varchar(500)), but the query takes an epic amount of time to execute. Is there a better way to handle this, or am I stuck?