Problem
Logs pagination uses OFFSET, which becomes slower as offsets grow and can skip/duplicate rows as new data arrives.
Proposed change
- Replace OFFSET pagination with keyset pagination using
timestamp (and a tie-breaker if needed).
- Persist the last-seen cursor and request the next page using
WHERE timestamp < :cursor.
Acceptance criteria
- Large paginations remain performant.
- No duplicates or gaps when new data arrives during paging.