gpt4 book ai didi

pagination - 偏移分页与光标分页

转载 作者:行者123 更新时间:2023-12-02 11:17:04 28 4
gpt4 key购买 nike

我正在研究分页,我有一些问题。

  • 两种方法有什么区别?
  • 基于游标的分页的最佳用例?
  • 基于光标的分页可以转到特定页面吗?
  • 基于光标的分页可以返回上一页吗?
  • 两者之间是否有任何性能差异?

  • 我的想法
    我认为基于光标的要复杂得多,这使得基于偏移量的分页更加可取。只有以实时数据为中心的系统才需要基于游标的分页。

    最佳答案

    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.



    引自此 awesome blog post ,快乐编码!

    另外,看看这个:

    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.



    这个解释来自 Appolo GraphQL docs .

    关于pagination - 偏移分页与光标分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55744926/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com