Pagination issue when sorting based on last modified property

I need to show some records sorted based on the changed column (last activity above) (Post with new edit or comments at the top)

The UI application has a twitter, for example, a “more” button for endless scrolling. each "more" will add the following 10 entries to the user interface.

The problem is that the pagination index breaks when any of the displayed entries changes

For example, suppose I have entries A,B,C,..Zin a jobs table.

The first time I show posts to the A-Juser with

SELECT * FROM Jobs WHERE 1 ORDER BY last_modified DESC LIMIT 0, 10

second time if none of the entries has been changed

SELECT * FROM Jobs WHERE 1 ORDER BY last_modified DESC LIMIT 10, 10

will return K-T

- J, "" ,

SELECT * FROM Jobs WHERE 1 ORDER BY last_modified DESC LIMIT 10, 10

J-S

J . , J , 9 . . 10 , A-J .

?

, .

?

+3
2

NOT IN() LIMIT LIMIT .

SELECT * FROM Jobs WHERE name NOT IN('A','B','C','D','E','F','G','H','I','J') 
ORDER BY last_modified DESC LIMIT 10

, 10 , , , sql.

+2

- Twitter ,

https://dev.twitter.com/docs/working-with-timelines

, id

id msg
1  A
2  B
....

10 , max post_id 10

SELECT * FROM Jobs WHERE id > 10 ORDER BY last_modified DESC LIMIT 0, 10
+1

All Articles