SQL - Indexing for performance on uniquness check...

From: "Loftis, Charles E" <charles(dot)loftis(at)eds(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: SQL - Indexing for performance on uniquness check...
Date: 2004-07-18 19:20:05
Message-ID: 25DC89BACF65D549BA045B806348C65E045DC783@ushem201.exse01.exch.eds.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2004-07-18 20:09:23 Re: SQL - Indexing for performance on uniquness check...
Previous Message Steve Tucknott 2004-07-18 11:00:39 FUNCTION error and UNICODE