Limit usage:
Select * From tablename limit [offset,] rows | rows offset
Example:
Select * From tablename limit 5, 10 // return 6-15 rows of records
Select * From tablename 5 // return 1-5 rows equivalent to: Select * From tablename 0, 5
Return the first 10000 records after the first one:
1st methods:
Select ID from tablename where ID> = (select max (ID) from (select ID from tablename order by ID limit 10001) as TMP) limit 100;
Time:
2nd methods:
Select ID from tablename where ID> = (select max (ID) from (select ID from tablename order by ID limit, 1) as TMP) limit 100;
Time:
From the above results, we can see that limit plays a role in performance optimization, which can avoid full table scanning. Because, if the 2nd methods use full table scanning, there will be 10000 rows from the beginning to more than 100, and the time will be similar to the first one. Now there is a difference of 14 times, limit can improve the performance of massive data queries.