【发布时间】:2018-08-04 00:24:07
【问题描述】:
我遇到以下查询问题:
select *
from testtable
where user_id = 1 and color = 1 and size = 1
order by created_at desc, id desc;
我使用了两个索引
index1 (user_id, color, size)index2 (created_at, id)
但我在解释结果中得到“使用位置,使用文件排序”
然后我将索引更改为使用所有五列
index1 (user_id ... id)
“使用文件排序”消失了,但我仍然得到“使用位置”
为了完全使用此查询的索引,我应该采取哪些进一步的步骤?
谢谢
【问题讨论】:
标签: mysql sql-execution-plan explain