MySQL??????????
???????????? ???????[ 2016/6/27 14:48:29 ] ????????????? MySQL
???????????з?????????????????????????????????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
????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11