admin管理员组文章数量:1405516
I am working with cursor pagination and sorting right now, for example you can paginate with cursor but you might also want it to be sorted in a certain field and direction for a api. ie. api/?cursor=1&sort_by=(id, asc)
My main discussion is around should the sorting change what your pagination key is? So let's suppose i am using id as the pagination key, and then I also want to sort by created_date desc, so is it better to do
Select * from table where (created_date, id) < (x, y) order by created_date desc, id desc or Select * from table where (id) < (y) order by created_date desc, id desc
The first would create a new list base on the new pagination key The second option always keep the same list but sort it later
本文标签: Interaction between sorting and cursor paginationStack Overflow
版权声明:本文标题:Interaction between sorting and cursor pagination - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744917810a2632104.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论