|
|||||||||||
|
RE: Using index for group-by: Not working?
From: Andrew Armstrong <andrew(at)mammoth.com.au>
Date: Sat Jul 28 2007 - 23:31:53 EDT
This probably throws out any chance of using an index for group by? Cheers
-----Original Message-----
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 thisindex 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 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=lists@pantek.comReceived on Sat Jul 28 23:32:50 2007 This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:29:33 EDT |
||||||||||
|
|||||||||||