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

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -