The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Use cursor (keyset) pagination when clients move sequentially through a large or frequently changing collection, especially when deep-page performance matters. Use offset pagination when users need numbered pages or direct jumps, provided the workload can tolerate the cost of skipping rows. If you need both behaviors, combine the methods deliberately.
How cursor and offset pagination work
Offset pagination identifies a position in an ordered result set: skip a specified number of rows, then return the next batch. A request for a later page therefore asks the database to pass over the rows before it.
Cursor pagination identifies a boundary in that order. The client or API retains values from the last item on the current page and requests items beyond those values. In database discussions this is often called keyset pagination; an API may package the continuation position in an opaque cursor token or URL.
Recommended Free Tools
Which one should you use?
| Need | Better starting point | Why | Caveat |
|---|---|---|---|
| Jump to page 20 or show numbered page controls | Offset | It maps directly to page-number semantics. | Deep offsets can require processing skipped rows, and changes before the offset can shift results. |
| Load successive pages through a large feed or export | Cursor/keyset | It continues from the last ordered key instead of repeatedly skipping a growing prefix. | It needs deterministic ordering, suitable indexes, and correct continuation handling. |
| Traverse a collection that changes while it is being read | Usually cursor/keyset | It is less sensitive to inserts or deletes before the previous boundary. | It does not by itself provide a frozen, point-in-time snapshot. |
| Support both page jumps and efficient next/previous navigation | Hybrid | Use cursors for adjacent navigation and offsets for explicit jumps. | Define consistent ordering and account for offset costs on jump requests. |
Why deep offset pages can cost more
To return rows after a large offset, a database may still need to process the rows it will skip. Microsoft’s Entity Framework Core pagination guidance notes that this work can grow with the number of skipped entries. A keyset query can seek from the last key when an appropriate index supports its ordering and predicates. That is a design advantage, not a universal speed guarantee: actual performance depends on the database, index, filters, data distribution, and workload.
#1 Best Overall
Offset pagination’s other trade-off is position drift. If a row is inserted or deleted before a requested offset between page requests, later results may shift, causing a client to miss or see a row twice. Keyset pagination is less sensitive to changes below the last-seen boundary, but neither method alone guarantees a transactionally consistent view of a changing collection. Microsoft Graph’s collection guidance likewise warns that changes can lead to missing or repeated results.
Make ordering deterministic before paging
Pagination needs a fully unique order. Sorting only by a timestamp is not enough if multiple rows can share it. Add a unique tie-breaker, such as an ID, so every row has a definite place. Microsoft’s EF Core guidance states, “Regardless of the pagination method used, always make sure that your ordering is fully unique.”
For keyset pagination over created_at and id in ascending order, retain both values from the final item and query for rows beyond that pair:
created_at > last_created_at
OR (created_at = last_created_at AND id > last_id)
This lexicographic condition prevents rows sharing a timestamp from being skipped. For descending traversal, reverse the comparisons and ordering. Include every sort key in the continuation condition, and create indexes aligned with the ordering columns and relevant filters. Microsoft’s EF Core documentation emphasizes that indexes should correspond to the pagination ordering; a cursor without a matching access path does not ensure a fast query.
Rank #3
How to handle cursors in an API
An API cursor is generally a continuation token, not a raw database cursor. Return it exactly as the API specifies; do not construct or edit it. Keep the original filters and sort order consistent across requests, and follow the API’s page-size and continuation rules.
For example, Microsoft Graph requires clients to treat its nextLink URL as opaque. Its guidance also recommends stable ordering, supplemented with additional sort keys—typically a key—when needed. GraphQL APIs may expose fields such as endCursor and hasNextPage, then accept the cursor as the next request’s after value. Microsoft’s Data API Builder guidance for GraphQL after says the cursor is opaque and should be treated as immutable.
These are API-contract examples, not interchangeable rules for every service. Microsoft Graph and Zendesk, for instance, define their own continuation behavior and endpoint capabilities. Zendesk’s comparison of cursor and offset pagination recommends cursor pagination where possible for extremely large record sets, while noting that support, sorting and filtering options, page sizes, and limits vary by resource. Its endpoint-specific details should not be assumed to apply to other APIs.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11When you need a complete export
If an export or audit must represent an exact point in time, define that consistency or snapshot contract separately. Pagination determines how to fetch successive portions; it does not, by itself, freeze the dataset while the fetch runs. Verify how the database or API handles concurrent changes and choose a snapshot strategy that meets the completeness requirement.
Quick Recap
How to choose with confidence
- Choose offset when numbered-page navigation or direct jumps are essential and the expected offsets are acceptable.
- Choose cursor/keyset when traversal is sequential, the collection is large, or deep-offset work is a concern.
- Use a hybrid when both direct jumps and efficient adjacent navigation matter.
- Before implementation, make the sort order unique, align indexes with the sort and filters, and confirm the continuation contract.
- Benchmark the actual query plan and workload before making numerical speed claims; there is no universal speed multiplier that applies across databases.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

