hi all:
) After reading the book ,i have a good understanding of Using Explain to see the execution plan of mysql,except for the meaning of "using where " appeared at “Extra” sometimes.
eg. for the information below:
CREATE TABLE newsfeeds (
id bigint(20) NOT NULL,
user_id bigint(20) NOT NULL,
source_id bigint(20) NOT NULL,
target_ids varchar(1000) DEFAULT NULL,
template_bundle_id bigint(20) DEFAULT NULL,
template_data varchar(4000) DEFAULT NULL,
app_id bigint(20) DEFAULT NULL,
app_item_id varchar(50) DEFAULT NULL,
created_at bigint(20) NOT NULL,
updated_at bigint(20) DEFAULT NULL,
splittime datetime NOT NULL DEFAULT ‘2000-01-01 00:00:00’,
star bit(1) DEFAULT NULL,
from_type tinyint(4) DEFAULT ‘0’,
PRIMARY KEY (id,splittime),
KEY idx_userid_createat (user_id,created_at),
KEY idx_userid_star_createat (user_id,star,created_at),
KEY idx_splittime (splittime),
KEY idx_userid_appid_createat (user_id,app_id,created_at),
KEY idx_userid_tempbd_createdat (user_id,template_bundle_id,created_at),
KEY idx_userid (user_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
mysql> explain extended select id from newsfeeds where id<100000 \G;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: newsfeeds
type: range
possible_keys: PRIMARY
key: PRIMARY
key_len: 8
ref: NULL
rows: 12
filtered: 100.00
Extra: Using where; Using index
1 row in set, 1 warning (0.00 sec)
As the book says ,[using where] means mysql will post-filters
rows from storage engine,but since id can be get through covering index and with no need to read rows again,i have no idea why it shows here!
The question has puzzle me for a very long time,so I’m urgent for your answer!
thanks a million!