Answer the question
In order to leave comments, you need to log in
How to execute a SQL page query if there was an offset?
Hello. I have a selection of posts from the database, they are sorted by rating and ID.
I did an Ajax upload. And I do a sample of 20 per page. And with each load I increase the page by 1.
There was a problem when new posts appeared that are higher, there is a shift by the number of new posts. If, for example, they added 2 new posts and I start loading, then the last 2 posts will be repeated.
Which is understandable. And then what is the best way to do it?
Answer the question
In order to leave comments, you need to log in
And this is just the second reason why you should not use offset for pagination. (the first reason is the performance of offset)
Pass the sort values of the last visible element of the list and ask for the continuation of the list, not offset.
https://use-the-index-luke.com/sql/partial-results...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question