【无标题】-11.extra列

时间:2024-04-22 16:25:28

顾名思义,额外信息

这里只列一些常用的

  • Using index

    查询以及搜索条件只包含属于某个索引的列(索引覆盖)

  • Using index condition

    mysql> EXPLAIN SELECT * FROM s1 WHERE key1 > 'z' AND key1 LIKE '%b';
      +----+-------------+-------+------------+-------+---------------+----------+---------+------+------+----------+-----------------------+
      | id | select_type | table | partitions | type  | possible_keys | key      | key_len | ref  | rows | filtered | Extra                 |
      +----+-------------+-------+------------+-------+---------------+----------+---------+------+------+----------+-----------------------+
      |  1 | SIMPLE      | s1    | NULL       | range | idx_key1      | idx_key1 | 303     | NULL |  266 |   100.00 | Using index condition |
      +----+-------------+-------+------------+-------+---------------+----------+---------+------+------+----------+-----------------------+
      1 row in set, 1 warning (0.01 sec)
    

    有些搜索条件中虽然出现了索引列,但却不能完全使用索引

    比如上面的sql, 先根据key1 > 'z'这个条件,从二级索引idx_key1中获取到对应的二级索引记录,先不着急回表,而是先检测一下该记录是否满足key1 LIKE '%a',再回表(他们的这个改进称之为索引条件下推(英文名:Index Condition Pushdown)也就是Using index condition

  • Using where

    全表扫描并且,该语句的WHERE子句中有针对该表的搜索条件,或者是走了索引,但是还需要再过滤一次