Hi,

 

I have the following query:

 

SELECT c2, c3, c4, Count(DISTINCT c5)

FROM table1 

WHERE c1 IN (1, 2, 3...)

GROUP BY c2, c3, c4

order by null

 

Yet I can only get it at best to show (under extra): Using where, using
filesort.

 

I have read up on:
http://dev.mysql.com/doc/refman/5.0/en/loose-index-scan.html and
http://dev.mysql.com/doc/refman/5.0/en/distinct-optimization.html and
http://dev.mysql.com/doc/refman/5.0/en/explain.html yet cannot get this
index to be used.

 

I am running MySQL '5.1.17-beta-community-nt-debug'

 

There are over 600,000 rows in table1 for my testing.

 

I have tried placing indexes on: idx(c2, c3, c4, c5) and idx(c1, c2, c3, c4,
c5) and indx(c5, c1, c2, c3, c4) with no result.

 

Is there a reason I cannot get this query to use an index for grouping?

 

Cheers,

Andrew

Reply via email to