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.6k 阅读✓ 已解决
8 回答1.4k 阅读
3 回答1.2k 阅读✓ 已解决
4 回答2.2k 阅读
3 回答1.1k 阅读✓ 已解决
2 回答1.8k 阅读
1 回答949 阅读✓ 已解决
如果mysql优化器不够智能的话,第一个sql就会先找到type满足1,2,3,4,5的,然后再找type=1的,肯定比第二个sql性能差。
具体试试就知道了