concept
Keyset pagination
Use a predicate based on the last returned ordering key, including a unique tie breaker. This avoids positional skipping but does not guarantee a consistent snapshot across requests.
Formal Syntax & Structure
sql syntaxsql
WHERE sort_key > last_key OR (sort_key = last_key AND id > last_id)Working Example
Example Snippetsql
WITH t(k,id) AS (VALUES (1,1),(1,2),(2,3)) SELECT id FROM t WHERE k>1 OR (k=1 AND id>1) ORDER BY k,id LIMIT 2;