1、查詢語句中所需的列在索引中,這樣查詢結果就可以在索引的數據結構中找到。
2、由於覆蓋索引可以減少樹木的搜索次數,顯著提高查詢性能,因此使用覆蓋索引是一種常用的性能優化方法。
實例
+----+-------------+------------+------+-----------------------+--------------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+------------+------+-----------------------+--------------+---------+-------+------+-------------+
| 1 | SIMPLE | user_group | ref | group_id,group_id_uid | group_id_uid | 4 | const | 5378 | Using index |
+----+-------------+------------+------+-----------------------+--------------+---------+-------+------+-------------+
以上就是mysql覆蓋索引的理解。