OFFSET forces Postgres to scan and discard 50,000 rows on every page, making deep pages O(N). Concurrent inserts/deletes also shift offsets, causing duplicate or skipped items. Keyset pagination filters WHERE (created_at, id) < ($last_ts, $last_id) ORDER BY created_at DESC, id DESC LIMIT 20—staying O(log N) via index seek.
Follow-up Interview Question · Why is including a unique tie-breaker like id essential alongside created_at in cursor pagination?