首页 > 技术文章 > sql优化

gpfeisoft 2015-09-15 14:20 原文

原语句:SELECT id, catid, title, keywords, description, inputtime
FROM news
WHERE catid = 5827117610
ORDER BY id DESC LIMIT 1250, 50
优化后:SELECT id, catid, title, keywords, description, inputtime
FROM news
inner join (select id
               from news
              where catid = 5827117610
              ORDER BY id DESC LIMIT 1250, 50) as lim
 using (id);

推荐阅读