???????????з?????????????????????????????????SQL??limit????????????????????????????????????????????????????????????Ρ?
????1. ??????????????
???????????????У???????????????Σ?????????????????????Σ????????????????????????????50w?е?????????
????????????id???
????SELECT id FROM test.bas_table
????limit 400000??1000;
????-- 0.094 second
??????????????
????SELECT * FROM test.bas_table
????limit 400000??1000;
????-- 0.547 second
????????????????6??????????????????????????θ??????????????????
?????????????????????????????????????Ρ?
????2. ????????2????
?????????????????????????????????????????????????Σ???????2????????????????????id?????
????1) id?????
????????????????Сid????????id???????
????SELECT
????*
????FROM
????bas_table a
????WHERE
????id >= (SELECT
????id
????FROM
????test.bas_table
????LIMIT 400000 ?? 1)
????LIMIT 1000;
????-- 0.078 second
????2) ????id??join
????????????????????id?????????????????
????SELECT
????*
????FROM
????bas_table a
????INNER JOIN
????(SELECT
????id
????FROM
????test.bas_table
????LIMIT 400000 ?? 1000) b ON a.id = b.id;
????-- 0.094
????????????????????????????????