Offset and keyset pagination
Offset and keyset pagination (or seek, as Markus Winand calls it) represent two well-known techniques for paginating data while fetching it from the database. Offset pagination is quite popular because Spring Boot (more precisely, Spring Data Commons) provides two default implementations for it, via the Page
and Slice
APIs. Therefore, in terms of productivity, it's very convenient to rely on these implementations. However, in terms of performance, while your project evolves and data keeps accumulating, relying on offset pagination may lead to serious performance degradations. Nevertheless, as you'll see soon, jOOQ can help you to sweeten the situation.
Conversely, keyset pagination is a technique that sustains high performance, being faster and more stable than offset pagination. Keyset pagination really shines on paginating large datasets and infinite scrolling, while it leads to almost the same performance as offset pagination, especially...