Skip to content

Optimal paging queries #1679

Answered by jarohen
coadan asked this question in Ideas
Dec 30, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hey @coadan 👋

You're right in that :offset requires XT paging over all the results that you want to skip over (Postgres etc too, fwiw). In similar situations, I've tended to use attributes in the documents to filter on instead ('cursor-based pagination') - so, if you were paging through emails in the order they were received, and the last email on the page was received last Thursday, your client then requests '100 emails starting from last Thursday'. In this case, the query planner can then skip straight to the first item on the next page.

HTH!

James

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@coadan
Comment options

Answer selected by coadan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants