pagination - sergeyzolotukhin/learn-java-gradle GitHub Wiki

The only way to provide large datasets to clients is to use a paging mechanism

There are basically two different approaches to implement a Paginator
Offset method - In the offset method, the database counts up all rows until the desired row has been found. 
The rows before the desired row are skipped
 
    * limit-offset pagination can be inconsistent, Suppose a user moves from page n to n+1 while simultaneously a new element is inserted into page n
    * the advantage of being stateless on the server. 
 
Value based method - In this method, the next records are returned based on the last record of the previous page. 
Instead of line numbers, the last row is used as an “offset” value.
client-side pagination
 
server-side pagination
Database implementation options:
 Limit-offset
    
 
 Cursors 
    * Cursors have the desirable property of pagination consistency on arbitrary queries, showing results as they exist at the time the transaction was started
    * not scalable for too many clients

 Keyset Pagination (Value based) 
Links

https://blog.novatec-gmbh.de/art-pagination-offset-vs-value-based-paging/
https://www.citusdata.com/blog/2016/03/30/five-ways-to-paginate/

⚠️ **GitHub.com Fallback** ⚠️