SELECT info.id,info.IsTop,info.IsNew,info.Title,info.TitleColor,info.TitleBold,info.IsLink,info.Url,info.Thumb,cate.id as cateid,cate.name as catename FROM article info inner join article_relate as relate on relate.id=info.id and relate.CateID in (20) inner join category as cate on cate.id=relate.CateID WHERE ( info.status = 1 ) ORDER BY info.IsTop desc,info.sort desc,info.UpdateTime desc,info.PostTime desc LIMIT 12其中where、on和order用到的字段都已经做了索引了。数据量也不是太大,几万条,结果用了0.400163s,请大虾帮忙优化一下。
FROM egov_article info
INNER JOIN egov_article_relate AS relate ON relate.id = info.id
AND relate.CateID
IN ( 93 )
WHERE (
info.status =1
)
ORDER BY info.IsTop DESC , info.sort DESC , info.UpdateTime DESC
LIMIT 0 , 20