Problem Statement
Which pagination choice avoids high OFFSET cost at large page numbers?
Explanation
Seek uses a “where key > lastKey” predicate. The index can resume quickly without scanning skipped rows.
It is stable and efficient but requires a deterministic order and a resume token.
Code Solution
SolutionRead Only
SELECT * FROM posts WHERE id < :cursor ORDER BY id DESC LIMIT 20;
Practice Sets
This question appears in the following practice sets:
