![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
Charles, Sample query to return non-uniqueness SELECT A1, A2, A3, ..., An FROM Table GROUP BY A1, A2, A3, ..., An HAVING Count(*)>1 In order for it to be even possible to use an index (a hashaggregate operation, actually) on this table, you'd have to include *all* of the GROUP BY columns in a single, multi-column index. However, it would be unlikely for PG to use any kind of an index in the operation above, because of the number of columns, the unlikelyness of grouping (i.e. there will only be a minority of rows with count(*) > 1) and the fact that you're running this against the whole table. So any kind of an index is liable to be useless. |
![]() |
| Thread Tools | |
| Display Modes | |
| |