API Design · Middle · Question 13 of 75
Why does offset pagination produce duplicates or gaps when items are inserted while paging?
- 1Databases randomize order each time
- ✓Correct answer: Positions shift: a new item at the top pushes everything down, so page 2 repeats the last item of page 1
- 3Offset pagination deletes items
Explanation
Cursor pagination based on a stable sort key (e.g. createdAt, id) doesn't have this problem.