How would you paginate an editable table whose records change during browsing?

Testing & architectureSystem designAbout 15 minutes

Understand the idea, explain it in your own words and use the rubric to find your next learning gap.

Local drafts · no account or AI calls
Sukoaa original

The idea behind the question

Stable cursor pagination needs a deterministic ordering and a tie-breaker, but its guarantees also depend on how concurrent inserts and updates affect that ordering.

AN ILLUSTRATIVE EXAMPLE

Many records share the same created time; sorting only by that value can skip or repeat records across page boundaries.

TRY A SMALL EXAMPLEJavaScript · standalone helper
// In-memory fixed snapshot only; a real API validates its cursor and ownership.
const rows = [{ time: 10, id: 2 }, { time: 9, id: 3 }, { time: 10, id: 1 }];
const ordered = [...rows].sort((a, b) => a.time - b.time || a.id - b.id);
const cursor = { time: 10, id: 1 };
const next = ordered.filter(r => r.time > cursor.time || (r.time === cursor.time && r.id > cursor.id));
console.log(JSON.stringify(ordered.map(r => r.id)));
console.log(JSON.stringify(next.map(r => r.id)));
Show expected output
[3,1,2]
[2]
Open JavaScript playground

Copy and paste to run in a separate tab. This example illustrates one concept; it is not a complete application or an automatically graded task.

A practical way to learn it

Design a cursor for records ordered by created time and ID. Walk through tied timestamps and an edit that moves a row, stating the user-visible policy.

Open PostgreSQL compiler

The related tool opens separately; your interview answer stays here. Written practice is self-guided, without automatic code grading.

Build an explanation you understand

  1. State what the concept does in plain language.
  2. Apply it to the example and make your assumptions explicit.
  3. Explain a trade-off, failure case and how you would test it.
  4. Distinguish your actual experience from a proposed approach.

Further reading

Further-reading links support learning; the reference is Sukoaa-authored, not an official employer answer key.