在索引上覆盖 SELECT 给出 using where;使用索引;而不是只使用索引;
Covering SELECT on index gives using where; using index; instead of only using index;
查询:
SELECT A from table_name where A = 'a';
解释输出
1 SIMPLE table_name ref A_idx A_idx 1 const 40582635 **Using where; Using index**
问题
我有一个复合索引A_idx on (A,B,C)...
我希望输出只是 using index,因为索引涵盖了完整的查询。但是我仍然得到 using where;使用索引...
相关列是具有以下定义的 ENUM。
A enum('a','b','c') COLLATE utf8_unicode_ci NOT NULL,
如 explain output documentation、"even if you are using an index for all parts of a WHERE clause, you may see Using where if the column can be NULL."
的相应部分所述
更新:文档还说 "if the Extra column also says Using where [besides using index], it means the index is being used to perform lookups of key values."
查询:
SELECT A from table_name where A = 'a';
解释输出
1 SIMPLE table_name ref A_idx A_idx 1 const 40582635 **Using where; Using index**
问题
我有一个复合索引A_idx on (A,B,C)...
我希望输出只是 using index,因为索引涵盖了完整的查询。但是我仍然得到 using where;使用索引...
相关列是具有以下定义的 ENUM。
A enum('a','b','c') COLLATE utf8_unicode_ci NOT NULL,
如 explain output documentation、"even if you are using an index for all parts of a WHERE clause, you may see Using where if the column can be NULL."
的相应部分所述更新:文档还说 "if the Extra column also says Using where [besides using index], it means the index is being used to perform lookups of key values."