Offset = skip N (slow, shifts on live data). Cursor = after this row (stable, O(1)). Infinite scroll on live feeds — cursors, full stop.
Разбор
Both = «next slice», different pointer:
- Offset — «skip N, take M», absolute position.
LIMIT 20 OFFSET 40 = page 3. List changes → positions move.
- Cursor (keyset) — «start after this item», pointer to stable value.
WHERE id < 8423 ORDER BY id DESC LIMIT 20. Row reference, not slot.
Offset: [ · · · · · · · · · · ] "skip 40, take 20" ← counts from the start every time
Cursor: [ · · · · ·│next 20···] "after id=8423" ← jumps straight to the boundary
Offset = position in list that can shift; cursor = reference to row that stays put.
Итог
Live infinite scroll → cursors; admin «page 47 of 200» → offset with eyes open to cost and drift.