select count(1) from A
where
1=1 and `status`=0 and `type` in (1,2,3,4,5) and
`type` ='1' AND time >= "1451185080";
与
select count(1) from A
where
1=1 and `status`=0 and
`type` ='1' AND time >= "1451185080";
的性能一样吗?
select count(1) from A
where
1=1 and `status`=0 and `type` in (1,2,3,4,5) and
`type` ='1' AND time >= "1451185080";
与
select count(1) from A
where
1=1 and `status`=0 and
`type` ='1' AND time >= "1451185080";
的性能一样吗?
4 回答1.4k 阅读✓ 已解决
8 回答1.3k 阅读
3 回答1k 阅读✓ 已解决
2 回答1.7k 阅读
2 回答1.5k 阅读
1 回答871 阅读✓ 已解决
1 回答668 阅读✓ 已解决
如果mysql优化器不够智能的话,第一个sql就会先找到type满足1,2,3,4,5的,然后再找type=1的,肯定比第二个sql性能差。
具体试试就知道了