keysetpagination
Keyset pagination, also known as cursor-based or seek pagination, is a method of paginating query results by using a reference key from the last item on the current page to retrieve the next set of items. Instead of counting rows from the beginning, subsequent pages are fetched by querying for records with keys greater than (or less than) the last seen key, combined with a stable sort order and a limit on the number of results.
The technique relies on a deterministic sort order, typically defined by a unique key such as an
Keyset pagination offers performance advantages over offset-based pagination. Since it does not skip over rows by
Limitations include the inability to jump directly to arbitrary pages without first traversing pages, and the
Common use cases include large lists in web interfaces, such as logs, feeds, or records with a