to_char、to_date效率问题记录

来源:互联网 发布:apache显示目录列表 编辑:程序博客网 时间:2024/06/09 16:01

避免在等号左边使用to_char、to_date.

例:

select * from table where to_char(date, 'yyyy-mm-dd') =  '2017-05-18' 

可改为

select * from table where date >= '207-05-18 00:00:00' and date <= '207-05-18 23:59:59'

你会看到耗时会减少很多

原创粉丝点击