Continuing a Result List with a Cursor
A pagination cursor can identify a place in a specified order, allowing a follow-up query for records past that boundary.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace a tied timestamp
If results order by time and then ID, a cursor can remember both values from the last entry. A timestamp alone could skip items with the same time. Composite keys provide the relevant ordered tuple of fields.
Keep the query semantics consistent
The cursor refers to a particular filtering and ordering policy. If filters change, start a fresh result set as documented. Compare offset pagination for its different position model.[1][2]
Carry every field needed to resume the order
Suppose rows are ordered by ascending day and ascending ID. The last row shown has day June 3 and ID seven. A following row on June 3 with ID nine is eligible because the tie field is larger. A later day is eligible regardless of ID. See composite SQL cursors.
Last pair: (June 3,7)
(June 3,6) → earlier
(June 3,9) → later
(June 4,1) → later
Keep cursor scope tied to filters and direction
A token for one filter or descending order may be invalid for a different view. Check how the interface handles expired or malformed cursors. Test matching and differing filter settings across pages.