Backend Developer
hardpagination-offset-vs-cursor

Offset vs cursor pagination: what’s the difference and when to use each?

Answer

**Offset pagination** (`?page=10`) is simple but can be slow and inconsistent on changing datasets. **Cursor pagination** uses a stable cursor (e.g., `createdAt` + `id`) and is faster for large lists and more consistent. **Trade-offs:** cursor pagination is more complex but scales better. Use cursor for high-traffic feeds and large datasets.

Related Topics

DatabasesAPIPerformance