Skip to content

QuizNot attempted

Offset vs cursor pagination

An infinite news feed gets new posts inserted at the top constantly. Which pagination?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • Cursor-based (?after=<lastId>): stable even when new items arrive
  • A cursor (?after=<lastId>) points at a stable position in the list, so new posts inserted at the top don't shift what the next page returns.
  • Not offset: every insert shifts all pages, so users see duplicates or miss items, and deep offsets are slow in databases.
  • Not load everything: an unbounded feed can't be fetched at once.
  • Not random sampling: a feed must be ordered and complete.
  • Offsets are fine for page-numbered tables whose data rarely changes.