Skip to content

Offset and cursor pagination#3

Open
kalexieva wants to merge 2 commits intomainfrom
pagination
Open

Offset and cursor pagination#3
kalexieva wants to merge 2 commits intomainfrom
pagination

Conversation

@kalexieva
Copy link
Collaborator

Change guidance to allow both offset and cursor. Remove the token offset option. Add guidance on when to choose each method.

- Users must be able to jump to an arbitrary page, this is a validated user need and not just an assumed one.
- UX requirements genuinely call for it, and the above technical factors do not contradict it.

**Note:** Cursor is also the safer default: switching from cursor to offset later is straightforward, but the reverse
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice:)

Use cursor-based pagination when:

- The dataset is large, unbounded, or expected to grow significantly over time.
- The underlying database is NoSQL or sharded, where offset scanning is expensive or unreliable.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth adding somewhere (either to this bullet or elsewhere) that sometimes databases support cursors natively (i.e. Datastore)?

- The database supports cursor-based pagination natively

Copy link
Collaborator Author

@kalexieva kalexieva Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just about every modern database supports cursor-based pagination natively today. Saying something like "only some databases natively support cursors" implies others don't, which would be misleading.

But I think I understand what you are trying to get at though. It's more about NoSQL and sharded databases tend to make offset pagination actively painful or explicitly don't support it?

So how about something more like this?

- The underlying database is NoSQL or sharded. These databases are often designed around 
  cursor-style access and may not support offset scanning at all or do so at significant
  performance cost.

…set option. Add guidance on when to choose each method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants