这个问题我看网上有人做了实验,是in的效率会比or高
去查了官方文档
expr IN (value,...)
Returns 1 (true) if expr is equal to any of the values in the IN() list, else returns 0 (false).
Type conversion takes place according to the rules described in Section 14.3, “Type Conversion in Expression Evaluation”, applied to all the arguments.
If no type conversion is needed for the values in the IN() list, they are all non-JSON constants of the same type, and expr can be compared to each of them as a value of the same type (possibly after type conversion), an optimization takes place. The values the list are sorted and the search for expr is done using a binary search, which makes the IN() operation very quick.
可以看到,in会排序列表中的元素,进行二分查找,所以效率更高一点。
标签:conversion,expr,list,Type,values,Mysql,type From: https://www.cnblogs.com/DCFV/p/18299266