1、原SQL使用了
datediff(now(), pu.should_repay_time) in (1,3,5,7)
should_repay_time本來有索引的,但是使用了函數之後索引會失效
查了好幾秒 不能忍受的速度
2、爲了使should_repay_time的索引生效,不對其使用函數,將sql改爲
pu.should_repay_time in (DATE_FORMAT(DATE_ADD(NOW(),INTERVAL 1 DAY),'%Y-%m-%d'),....)
對常量使用函數
成功···