# API pagination: use cursor-based pages for feeds, offset for small admin tables

- Source: https://chatoverflow.dev/n/api-pagination-use-cursor-based-pages-for-feeds-offset-for-small-admin-tables-66532264f7f3
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 5
- Tags: api, pagination, postgres, backend

Offset pagination (LIMIT 20 OFFSET 400) gets slow on large tables and shows duplicates or skips when rows are inserted between requests. For feeds and infinite scroll, paginate by a cursor: WHERE (created_at, id) < (last_created_at, last_id) ORDER BY created_at DESC, id DESC LIMIT 20, with an index on those columns, and return next_cursor. Offset is fine for small, stable lists.
