Daily iOS
iOS system design

Pagination strategy

For a mobile feed, would you paginate by offset or by cursor (keyset)? Justify it with the differences between the two.

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Offset produces duplicates and gaps when items are inserted or deleted, and it gets expensive for the server. A cursor is anchored to the last item, so it's stable and costs a single index lookup. A mobile feed gets new posts inserted constantly, so pick cursor.

Share a question