开发者

MySQL, how can I speed up this query which takes 1.4 second?

开发者 https://www.devze.com 2023-02-05 01:45 出处:网络
How can I speed up this query ? SELECT PadID, CatID, IconSoureURL, OsStr, PadURL, PageName, ProgramName,

How can I speed up this query ?

SELECT PadID, CatID, IconSoureURL, OsStr, PadURL, PageName, ProgramName,  
ProgramVersion, ReleaseStatus, English45, License, DownloadURL
FROM Pads
WHERE RemoveMeDate开发者_如何学运维 = '2001-01-01 00:00:00'
ORDER BY VersionAddDate DESC
LIMIT 360 , 40

I already have an index, heres the query explained .

MySQL, how can I speed up this query which takes 1.4 second?


Make an index on RemoveMeDate and VersionDate
CREATE INDEX new_index ON (RemoveMeDate, VersionDate);
you must ensure that the order by is done on a index ( index on RemoveMeDate and VersionDate should do that - RemoveMeDate part of the index will be used by where and VersionDate part of the index will be used by order by)


Do you have an index on RemoveMeDate though?


VersionAddDate should have index, not good to sort on non-indexed column.

0

精彩评论

暂无评论...
验证码 换一张
取 消