mysql> CREATE TABLE `t` (
`id` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=InnoDB
there is a table named t and it has two indexes named a and b. Insert into t 100000 rows data
mysql> create procedure idata()
begin
declare i int;
set i=1;
while(i<=100000)do
insert into t values(i, i, i);
set i=i+1;
end while;
end;
Query OK, 0 rows affected (0.01 sec)
mysql> delimiter ;
mysql> call idata();
I do some experiments, some are as follows
Now, i want to know;
(1)why explain select * from t where a >= 90000;
extra is Using index condition
? it has index key, but it doesn't have index filter and table filter, so why it is Using index condition
?
(2)why explain select * from t where a = 90000;
extra is NULL
? is needs to have an access to the table,if the first case is Using index condition
, why the second can't be Using index condition
?
(3)why explain select a from t where a >= 90000;
extra is Using where; Using index
? i know it uses cover index, so extra has Using index
;but why extra has Using where
? it means server needs to filter the data? but storage engine has already return the correct, why server needs to filer?