我的字段不为空,默认值为0。
我在此字段中添加了一个索引,
而我的条件是where this_field = 0
我试图对其进行“解释”,发现该索引根本不起作用,除非当我的条件为where this_field = other_value
或where this_field > 0
时,该索引才起作用...
解释
select * from course where organization_id = 0
id select_type table type possible_key key rows extra
1 SIMPLE course ALL oid_name null 97 Using where
解释
select * from course where organization_id > 0
id select_type table type possible_key key rows extra
1 SIMPLE course range oid_name oid_name 19 Using index