Connected infrastructure

Keep pagination consistent

Editorial edition · 16 November 2026

The idea

Pagination divides a large result into smaller responses. If the underlying records change between requests, a caller may otherwise miss a record or see it twice. The ordering and consistency model are part of the interface contract.

Design choice

Use a deterministic order with a unique tie-breaker. An opaque cursor can encode position without exposing storage details. For exports that need a fixed view, bind the cursor to a snapshot or an explicit time boundary and document expiry.

Worked example

An activity list sorts by creation time and event ID. Its cursor records both values. Newer events can appear at the top while the next request continues from the last item already returned.

Before you ship

  • Include a unique ordering key.
  • Test inserts during pagination.
  • Define cursor expiry and restart behaviour.

Examples are illustrative. Adapt the checks to your own environment.

Further reading

HTTP Semantics, RFC 9110

Search the library