Oracle查詢語句的優化-記錄一

select count(1) from ViewA t where t.name='張三' and t.lTime >='201306010000'   ---耗時44side


select count(1) from ViewA t where t.name='張三'  ---耗時4s索引


t.lTime是varchar類型。有索引,it


解決辦法:select count(1) from ViewA t where t.name='張三' and to_number(t.lTime) >=201306010000  class

---秒殺select


速度大大的提升了。緣由是數字類型的對比遠比字符類型的比較大小快不少。秒殺

相關文章
相關標籤/搜索