本文共 345 字,大约阅读时间需要 1 分钟。
样例如下:
1.创建表 create table t1( Id int not null PRIMARY key , Name varchar(20) not NULL DEFAULT ‘’, age int not null default 0, Email varchar(20) not null DEFAULT ‘’ );2.EXPLAIN优化分析:
EXPLAIN select * from t1 where name like ‘%aa%’; EXPLAIN select Name from t1 where name like ‘%aa%’;3.解决方案
– 覆盖索引 alter table t1 add index index_NameAge(Name,age);转载地址:http://dacjn.baihongyu.com/