索引失效情况:索引使用
使用explain 分析索引是否使用
explain select *from tbl_file where file_sha1='0c4b1036671ad0b2727a9d18349d02feae0e8161'; +----+-------------+----------+------------+-------+---------------+---------------+---------+-------+------+----------+-------+ | id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra | +----+-------------+----------+------------+-------+---------------+---------------+---------+-------+------+----------+-------+ | 1 | SIMPLE | tbl_file | NULL | const | idx_file_hash | idx_file_hash | 120 | const | 1 | 100.00 | NULL | +----+-------------+----------+------------+-------+---------------+---------------+---------+-------+------+----------+-------+ 1 row in set, 1 warning (0.00 sec)
possible_keys :可能索引 key:索引键