My Sql 高效分頁

來源:互聯網
上載者:User

/* *普通分頁 *在資料檔案上位移1000000查出10條 */select *from zoldesk_92game_net_ecms_bjwhere classid=303ORDER BY id ASCLIMIT 1000000,10 ;/* *高效分頁 *1、在索引上查出起始索引 *2、從起始索引上查出10條 */SELECT * from zoldesk_92game_net_ecms_bj WHERE id >=(    SELECT id    FROM zoldesk_92game_net_ecms_bj    where classid=303    ORDER BY id ASC    LIMIT 1000000, 1)and classid=303ORDER BY id ASCLIMIT 10 ;

這是樓下的辦法

SELECT * from zoldesk_92game_net_ecms_bj WHERE id in    (        SELECT id from     (        SELECT id            FROM zoldesk_92game_net_ecms_bj            where classid=303            ORDER BY id ASC            LIMIT 1000000, 10        )    AS temp)


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.