Oracle查询语句的优化-记录一
select count(1) from ViewA t where t.name='张三' and t.lTime >='201306010000' ---耗时44sselect count(1) from ViewA t where t.name='张三'---耗时4s
t.lTime是varchar类型。有索引,
解决办法:select count(1) from ViewA t where t.name='张三' and to_number(t.lTime) >=201306010000
---秒杀
速度大大的提高了。原因是数字类型的对比远比字符类型的比较大小快很多。
页:
[1]