Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LIMIT and OFFSET more efficient on large pagination #806

Closed
bedengler opened this issue Dec 7, 2018 · 0 comments
Closed

Make LIMIT and OFFSET more efficient on large pagination #806

bedengler opened this issue Dec 7, 2018 · 0 comments

Comments

@bedengler
Copy link

bedengler commented Dec 7, 2018

What's your experience on large offset values in big tables? Let's say with an offset value of 100000?
As stated here for example: http://devoluk.com/mysql-limit-offset-performance.html

Maybe enhance the LIMIT array optionally by a name for the primary index.

So if we call
new Medoo('table', "*", ['LIMIT' => [100000, 10, 'id'], 'ORDER' => ['date' => 'asc']]);
the resulting query would be
SELECT * FROM table a JOIN (SELECT id FROM table ORDER BY date ASC LIMIT 100000, 10) AS b ON a.id = b.id
which should be pretty damn fast... ;)

If the third value in the LIMIT array isn't given, it remains as it is currently:
SELECT * FROM table ORDER BY date ASC LIMIT 100000, 10

@catfan catfan closed this as completed Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants