Offset pagination vs Cursor pagination

核能气质少年 提交于 2020-06-14 07:44:20

问题


I am studying about pagination
and i have some question

-1. what is diff (title)

-2. what kind of situation is desirable to use cursor based pagination

-3. can cursor based pagination move to specific page?

-4. if(-3) how can cursor based pagination go back to Previous page?

-5. Are there performance differences?


My thought

I think cursor based is much more complex and most case offset based pagination is desirable. only real time data need cursor based pagination.


回答1:


Cursor pagination is most often used for real-time data due to the frequency new records are added and because when reading data you often see the latest results first. There different scenarios in which offset and cursor pagination make the most sense so it will depend on the data itself and how often new records are added. When querying static data, the performance cost alone may not be enough for you to use a cursor, as the added complexity that comes with it may be more than you need.

Quoted from this awesome blog post, happy coding!

Also, check this out:

Pagination is a solution to this problem that ensures that the server only sends data in small chunks. Cursor-based pagination is our recommended approach over numbered pages, because it eliminates the possibility of skipping items and displaying the same item more than once. In cursor-based pagination, a constant pointer (or cursor) is used to keep track of where in the data set the next items should be fetched from.

This explanation is from Appolo GraphQL docs.



来源:https://stackoverflow.com/questions/55744926/offset-pagination-vs-cursor-pagination

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!