# Pagination at Scale: Why OFFSET and SKIP Will Eventually Break Your API

DevFeed: [Pagination at Scale: Why OFFSET and SKIP Will Eventually Break Your API](<https://devfeed.tech/articles/pagination-at-scale-why-offset-and-skip-will-eventually-break-your-api-39566.md>)

Original publisher: [Read original article](<https://ankit-rana.com/logs/14-pagination-offset-vs-cursor/>)

Author: hello@ankit-rana.com

Published: 2026-03-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [Ankit Rana | Mechanical Sympathy](<https://devfeed.tech/sources/ankit-rana-mechanical-sympathy.md>)

Topics: [API](<https://devfeed.tech/topics/api.md>), [Database](<https://devfeed.tech/topics/database.md>), [MongoDB](<https://devfeed.tech/topics/mongodb.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [api-design](<https://devfeed.tech/tags/api-design.md>), [b-tree](<https://devfeed.tech/tags/b-tree.md>), [cursor](<https://devfeed.tech/tags/cursor.md>), [database-performance](<https://devfeed.tech/tags/database-performance.md>), [latency](<https://devfeed.tech/tags/latency.md>), [mongodb](<https://devfeed.tech/tags/mongodb.md>), [pagination](<https://devfeed.tech/tags/pagination.md>), [scalability](<https://devfeed.tech/tags/scalability.md>), [scale](<https://devfeed.tech/tags/scale.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

This article explains why OFFSET and SKIP pagination become slower and more memory-intensive as page depth increases. It presents cursor-based, or keyset, pagination as an alternative that uses an indexed range seek and reads a fixed number of rows, keeping fetch cost largely constant with list depth. The trade-off is that cursor pagination does not provide reliable absolute page numbers.

## Source excerpt

OFFSET does not seek. The engine fetches offset plus limit rows, sorts them, and discards the first N, so cost grows linearly with page depth. Cursor pagination passes the last seen key instead of a page number, letting the B+ tree seek in logarithmic time and read a fixed number of rows, which keeps latency flat at any depth. The price is losing absolute page numbers.