API Pagination Strategies
Offset Pagination
Uses ?limit=10&offset=20. Simple to implement, but scales poorly on large tables because the database must scan and discard the skipped rows. It also suffers from data drift (showing duplicates if items are inserted while the user paginates).
Cursor Pagination
Uses ?limit=10&after=cursor_xyz. Highly performant because it leverages database indexes directly (e.g., WHERE id > cursor_xyz). Eliminates data drift. However, it cannot jump to a specific page (e.g., "Page 15").
For most infinite-scroll feeds, Cursor pagination is strictly superior.