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
Written by Sun Ning
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mysql
Authors
Related Tags
#mysql
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#