liveBook · Manning

Pagination

As explained in ScyllaDB in Action

Pagination is a data-retrieval technique that divides query results into bounded pages fetched sequentially.

Pagination divides query results into bounded pages fetched sequentially. A LIMIT sets the page size, while a WHERE clause uses the previous page’s state to find the next rows. section 7.1.3

For example, a restaurant-review application can return 10 article summaries instead of hundreds. With descending TIMEUUID ordering, the next page selects rows whose id is less than the last id returned. ScyllaDB does not support OFFSET because accurately skipping rows would require fully executing the query and discarding results. section 7.1.3

Fetching the next page

Run the first query with LIMIT 2. Then reuse the final row’s id: SELECT id, title FROM article_summaries_by_date WHERE date_bucket = 0 AND id < 9f545786-704b-11ee-b962-0242ac120002 LIMIT 2; This returns the next two summaries.

How ScyllaDB in Action covers it

How deep it goes
Explains page size, ordered key boundaries, internal paging states, and the performance reason for omitting OFFSET.
Examples
Uses article-summary queries returning two rows, then advances through named review titles with decreasing id boundaries.
What it assumes
Assumes basic SELECT queries and an ordered table whose key can identify the next page boundary.
What you can do after
Apply it via CQL by limiting results and passing the previous page’s boundary or paging-state token to retrieve the next page.
How it connects
Connects LIMIT with WHERE clauses, ordering, TIMEUUID values, paging state, drivers, and OFFSET trade-offs.

Also explained in

Compare how 11 books explain pagination →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.