select * from table where col in (2,3,4,5,6)
select * from table where col=2 or col=3 or col=4 or col=5 or col=6
當col有索引的時候,in和or都會走索引,效率差不多
當col沒索引的時候,in 的效率比or高,in是log or 是n
select * from table where col in (2,3,4,5,6)
select * from table where col=2 or col=3 or col=4 or col=5 or col=6
當col有索引的時候,in和or都會走索引,效率差不多
當col沒索引的時候,in 的效率比or高,in是log or 是n
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。