SQL操作應(yīng)用——在屬性上進(jìn)行計(jì)算不能命中索引
提問人:ylm發(fā)布時間:2020-09-28
select * from order where YEAR(date) < = ‘2017’
即使date上建立了索引,也會全表掃描,可優(yōu)化為值計(jì)算:
select * from order where date < = CURDATE()
或者:
select * from order where date < = ‘2017-01-01’
繼續(xù)查找其他問題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評論>>