Implement server-side pagination efficiently
Migrate from offset to keyset pagination with a WHERE id > :cursor query pattern. Covers cursor encoding, non-unique sort fields, and the API response shape.
Preview
Copy prompt
Replace offset-based pagination on the [Table] table with cursor-based keyset pagination to eliminate duplicates and missing records on live data. Write the new SQL query filtering on a WHERE clause using the last seen cursor value. Show how to base64-encode the cursor to make it opaque to clients. Handle non-unique sort fields by including the primary key as a tiebreaker. Document the full change to the API request parameters and response envelope.
More
Performance
Prompts
