Client-side deduplication, advantage: simple to implement. Disadvantages: Data is inaccurate.
(Recommended) Sort by time. When the client obtains the next page of data, it returns the login time of the last data. When querying the database, select * from table where login time < the last data Login time order by login time.
Record a timestamp for each client. Update this timestamp when getting the first page. When querying the next page, select * from table where login time < timestamp order by login time limit current Page
If the order of users remains unchanged, you can record the last user displayed each time. After getting the next page from the server, search first. If there is the last user before, skip him and the previous users. , in order to avoid not having enough users, you may need to load a few more at a time according to the actual situation. If a user who was supposed to be on the second page moves to the front because he logged in again, that should be fine, and generally no one will notice.
Several options:
Client-side deduplication, advantage: simple to implement. Disadvantages: Data is inaccurate.
(Recommended) Sort by time. When the client obtains the next page of data, it returns the login time of the last data. When querying the database, select * from table where login time < the last data Login time order by login time.
Record a timestamp for each client. Update this timestamp when getting the first page. When querying the next page, select * from table where login time < timestamp order by login time limit current Page
If the order of users remains unchanged, you can record the last user displayed each time. After getting the next page from the server, search first. If there is the last user before, skip him and the previous users. , in order to avoid not having enough users, you may need to load a few more at a time according to the actual situation. If a user who was supposed to be on the second page moves to the front because he logged in again, that should be fine, and generally no one will notice.