System Design Patterns: From Fundamentals to Real Systems
Vote

0% completed

​

Cursor-Based Pagination

1. The Pattern

Do not tell the API which page you want. Tell it where you left off. A cursor is an opaque bookmark ("everything after order 8412") instead of a page number ("items 101-120"). It is anchored to a row, not to a count. That makes it immune to the two failure modes that kill offset pagination at scale.

Offset pagination asks for a numbered page and makes the database skip a specified row count before returning results, while the store's current API demonstrates both important failure modes.

Failure one: drift. The mobile order feed treats ?page=2 as

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content