Is there a method of pagination that can reliably sort by a volatile aggregate parameter?

Viewed 90

I'm building an API which has a component similar to https://www.twitch.tv/directory/all , which is sorted by the number of "active" members in the chat. In twitch this would be translated as viewers.

As you can plainly see, the list in the link is paginated somehow. In my application, viewers would be leaving left and right, resulting in my pagination cursor drifting if I were to specify an offset of viewers.

Is the answer simply to send up from a frontend a list of ids they already have in the pagination set and run the exact same SQL query using a WHERE NOT IN clause? I'm really curious as to how an application like twitch manages to paginate its results by such a drifting number like viewer count.

0 Answers
Related