mysql between and 和大於等於、小於等於問題

table表end_time爲索引列,當end_time在同一天時,兩個sql索引生效,非同一天時,索引無效;

 

explain select * from table where end_time >= '2019-04-22 00:00:00' and end_time <= '2019-04-22 23:59:59';
explain select * from table where end_time BETWEEN '2019-04-22 00:00:00' and '2019-04-22 23:59:59';

 

同一天:

非同一天:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章