select count(1) from ViewA t where t.name='张三' and t.lTime >='201306010000' ---耗时44s
select 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
---秒杀
速度大大的提高了。原因是数字类型的对比远比字符类型的比较大小快很多。