Pagination patterns in Amazon Aurora DSQL
Database Blog
This article explains pagination patterns for Amazon Aurora DSQL, a serverless distributed SQL database, and how to optimize them for performance and cost.
- OFFSET/LIMIT pagination works but becomes expensive on deep pages in distributed systems
- Keyset (cursor-based) pagination recommended: consistent performance, lower DPU costs, fewer OCC conflicts
- Implement cursors as opaque tokens encoded in API responses for stateless pagination
- Create composite indexes with INCLUDE clauses to enable index-only scans
- Batch processing must respect 3,000-row transaction limit and use short transactions
- Avoid COUNT(*) queries, deep OFFSET pagination, long-lived transactions, non-deterministic sorts
- Use deterministic sort orders with primary key tiebreakers for stable pagination
- Aurora DSQL uses optimistic concurrency control; fast queries reduce conflict windows
Keyset pagination is the recommended approach for Aurora DSQL workloads, delivering consistent performance and predictable costs as data scales.
The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.
Related articles
The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.