indexing - MySQL is not using index on very simple GROUP BY query -
here table create/schema:
create table `_test` ( `id` int(10) unsigned not null auto_increment, `group_id` int(10) unsigned not null, `total` int(10) unsigned not null, primary key (`id`), key `group_id` (`group_id`) ) engine=myisam auto_increment=1 default charset=latin1
so 2 keys - primary on id , index on group_id.
and here data sample:
now, thing when run explain following simple query:
explain select sum( total ) _test group (group_id)
i getting no use of key despite 1 being created on group_id column:
any ideas why mysql not trying use group_id index query?
Comments
Post a Comment