select * from tablename where aa like '%关键字%' order by id desc
--方式好象要全表扫描,试下:
select * from tablename where aa like '关键字%' order by id desc
--id 字段也建索引.
--方式好象要全表扫描,试下:
select * from tablename where aa like '关键字%' order by id desc
--id 字段也建索引.
select '1111' union all
select '2222' union all
select '2222' union all
select '2222' union all
select '2222' union all
select '2222' union all
select '2222' union all
select '关键字' select * from aa where aa like '%关键字%' order by id desc
这个时候用的是索引
然后在aa上建立非聚集索引查询成本也用的是索引阿