+ -
当前位置:首页 → 问答吧 → 请教关于基于substr的索引的问题

请教关于基于substr的索引的问题

时间:2011-12-05

来源:互联网

SQL code


select count(*) 
--,substr(id, 2, 4) 
  from t
 group by substr(id, 2, 4)



我在表t上加了一个索引在substr(item_id, 2, 4)上,执行上面的sql能够进入索引,可是把注释处的代码加入后,执行时就变成了全表查询,请问怎么样才能在加入注释中的代码的情况下仍然保证sql使用到索引

作者: tgrdgdfcbv   发布时间: 2011-12-05

加hint试试呢?

作者: tx2730   发布时间: 2011-12-05