prisma-extension-pagination icon indicating copy to clipboard operation
prisma-extension-pagination copied to clipboard

Add a skip option to the cursor pagination

Open AlexRMU opened this issue 3 months ago • 9 comments

For some reason, in most tutorials and articles about cursor pagination it is written that, unlike offset pagination, cursor does not allow you to jump to the desired page (skip a certain amount). But that's a lie! You can simply perform a normal cursor search and then skip the required amount. Thus, the advantages of the cursor and offset capabilities will remain, and the speed will hardly change (if you do not skip a lot).

https://github.com/neo4j/neo4j/issues/12695 https://arpitbhayani.me/blogs/fast-and-efficient-pagination-in-mongodb/ https://www.mongodb.com/docs/manual/reference/method/cursor.skip/

Even the prisma documentation says that with the cursor pagination, you need to skip 1 row in order not to include it in the result. What prevents you from skipping more?

I suggest adding a skip and includePageCount in the cursor pagination options and changing the meta accordingly.

AlexRMU avatar Apr 02 '24 15:04 AlexRMU