时间范围查询优化技巧

1 对datetime和timestamp建索引

2 查询语句强制使用索引 SELECT * from task FORCE INDEX(unique_key_taskno) where TASK_NO = 'FZ202008140051'

3 尽量使用between and 而不是大于 小于

4 如果能把日期转换为long型那是最好的

posted on 2020-11-18 09:14  MaXianZhe  阅读(783)  评论(0编辑  收藏  举报

导航