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:

enter image description here

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:

enter image description here

any ideas why mysql not trying use group_id index query?


Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -