Hello everyone,
Let us assume we have a table
create table T (id int unsigned primary key auto_increment, php int);
create index i_php on T(php);
Now let us insert 2 million rows into this table with php being numbers from 1 to 5. Thus we have just 5 distinct values.
And now the problem: when I execute one of the following
select distinct php from T
or
select php from T group by php
it takes about 2 - 3 secs on my system to return the 5 indexed values but it must have taken just fractions of a second to lookup index and return 5 values. Where is the problem? Can anyone share his/her knowledge of how to make it read directly the indexed values?
Any comments are welcome.
Thanx