mysql> explain select * from test where substr(stat_day, 0 ,5) = '20131'\G;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: test
type: index
possible_keys: NULL
key: test
key_len: 10
ref: NULL
rows: 3
Extra: Using where; Using index
1 row in set (0.00 sec)
[/quote]建议提问时保持例子问题的一惯性。你的例子和你顶楼的已经不是一个语句了。
请同时贴出
explain select ....
show index from ...
mysql> explain select * from test where substr(stat_day, 0 ,5) = '20131'\G;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: test
type: index
possible_keys: NULL
key: test
key_len: 10
ref: NULL
rows: 3
Extra: Using where; Using index
1 row in set (0.00 sec)