MySQL似乎没有为order by使用唯一索引

时间:2017-04-25 05:00:19

标签: mysqli sql-execution-plan

我执行以下查询

EXPLAIN 
 SELECT *
   FROM firmware_versions
  WHERE serial_number    = '123'
    AND hardware_version = 'version-1'
    AND firmware_type    = 'avr'
  ORDER BY creation_time DESC
  LIMIT 1

唯一索引超过(serial_number, hardware_version, firmware_type, creation_time DESC)

但是以下查询的结果告诉我typerange,它会扫描表格中901行中的100行,而extrausing index condition。不应该只是ref,即转到索引,从中获取第一项,返回?

0 个答案:

没有答案