Your query requires a single full table scan and a sort on group by. If the data distribution is such that sorting requires a lot of resources then you should try the following one (and a composite index on COL1, COL2 and COL3 will be very helpful):
SELECT col1 FROM tab1 x WHERE EXISTS
(SELECT NULL FROM tab1
WHERE col1=x.col1 AND col2=x.col2 AND col3=x.col3 AND rowid != x.rowid);
Again, this might or might not be a better one, try it yourself on your actual data.
HTH,
Jurij Modic ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Bookmarks