MySQL 列默认 NULL 是否使用了索引

MySQL5.7 实例

单列索引(KEY index (user_name))
WHERE user_name = 'gaodevops'
WHERE user_name IS NULL
WHERE user_name IS NOT NULL 未使用索引(ALL)

联合索引(KEY index (user_name,phone))
WHERE user_name = 'gaodevops' AND phone = '136XXX'
WHERE phone = '13XXX' AND user_name = 'gaodevops'
WHERE user_name IS NULL
WHERE user_name IS NOT NULL 未使用索引(ALL)
WHERE phone = '136XXX' 未使用索引(ALL)
WHERE phone IS NULL 未使用索引(ALL)
WHERE phone IS NOT NULL 未使用索引(ALL)

gaodevops