This guide explains how LIMIT and OFFSET work in PostgreSQL, their use cases for pagination, why large OFFSET values cause performance issues, and when to switch to cursor-based pagination. It includes syntax examples, mandatory ORDER BY requirements, common pitfalls, and alternative methods aligned with PostgreSQL and GitHub REST API standards.
PostgreSQL / database pagination / LIMIT / OFFSET / cursor-based pagination / query performance
Distinguish storage, validation and shared caching. Three response policies show when to use public max-age, private no-cache and no-store.
Cache-Control / HTTP / Caching / Web Development / Privacy / Security / Browser / CDN
Separate a request timeout from the total retry budget, interpret Retry-After, and avoid duplicating writes when the server outcome is unknown.
HTTP / Retries / Timeouts / Idempotency
Define the caller, payload, atomic claim and replay policy so a retry has a predictable application result.
web
Understand the differences between offset-based and cursor-based pagination and when to use each, especially when dealing with frequently changing datasets.
api / pagination / rest / offset / cursor / data consistency / web development
Separate authentication, permissions, rate limits and service availability before retrying.
HTTP / API / Troubleshooting
Use If-None-Match to revalidate cached responses and If-Match to avoid overwriting a newer representation.
HTTP / ETag / Caching
Distinguish response access from request sending, inspect an OPTIONS preflight and configure explicit origins for credentialed browser requests.
HTTP / CORS / fetch / API / Troubleshooting