Last Updated: February 25, 2016
·
1.409K
· sunng

Speed up MySQL query with large offset

The query goes slower when you have a larger offset. This is to improve this issue.

SELECT t.*
FROM (
SELECT id
FROM mytable
ORDER BY
id
LIMIT 10000, 30
) q
JOIN mytable t
ON t.id = q.id

But sadly, it's still not constant.

Source: http://stackoverflow.com/questions/4481388/why-does-mysql-higher-limit-offset-slow-the-query-down