Dan Nelson wrote:
>Yes, with only 24 values, MySQL will probably never use that index for
>paring down records in a regular SELECT. But for your count() case it
>should.
>
>
According to the EXPLAIN output, it does; but its still horrifically slow.
mysql> explain SELECT count(DISTINCT(sig_class_id)) FROM acid_event;
+------------+-------+---------------+--------------+---------+------+--------+-------------+
| table | type | possible_keys | key | key_len | ref |
rows | Extra |
+------------+-------+---------------+--------------+---------+------+--------+-------------+
| acid_event | index | NULL | sig_class_id | 5 | NULL |
377222 | Using index |
+------------+-------+---------------+--------------+---------+------+--------+-------------+
Mind you, it doesn't pare it down much ...
--
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock