【发布时间】:2023-03-22 16:40:01
【问题描述】:
我有这个问题:
SELECT *
FROM `EpisodeDetailed`
WHERE Language LIKE "%en%"
AND AddedDate >= "2020-01-13"
AND (Tags="1509"
OR Tags LIKE "%1509"
OR Tags LIKE "1509%"
OR Tags LIKE "%1509%"
)
ORDER BY AddedDate, Votes
LIMIT 50
而且我用的时候不到0.1s:
ORDER BY AddedDate ASC, Votes ASC
或
ORDER BY AddedDate DESC, Votes DESC
但是我用的时候很慢(大约4s)
ORDER BY AddedDate ASC, Votes DESC
或
ORDER BY AddedDate DESC, Votes ASC
为什么?
【问题讨论】:
-
Curious ORDER BY addedDate, Votes 与 ORDER BY addedDate ASC, Votes ASC , ASC 为默认值。
-
您在 AdditionalDate 和 Votes 列上有索引??
-
EXPLAIN SELECT...输出什么?