MySQL为什么不在用作布尔值的int字段上使用索引?

Sen*_*ful 4 mysql indexing

select * from myTable where myInt
Run Code Online (Sandbox Code Playgroud)

即使myInt字段上有索引,在解释查询时也不会显示任何possible_keys.

编辑:
有问题的索引不是唯一的.

Sen*_*ful 5

要使MySQL使用索引,必须将int字段与值明确比较(例如,true,1).

select * from myTable where myInt = true
Run Code Online (Sandbox Code Playgroud)