Spring 数据 JDBC 的键集分页可分页
Keyset Pagination for Spring Data JDBCs Pageable
据我所知,Pageable class supports only LIMIT/OFFSET based paging. However, while being a quite universal solution, it comes with some downsides as outlined here https://momjian.us/main/blogs/pgblog/2020.html#August_10_2020
Keyset Pagination(又名 Seek Method 或 Cursor-based Pagination)有一些好处在并发数据插入和删除期间的性能和行为方面。详情见
- https://use-the-index-luke.com/no-offset
- http://allyouneedisbackend.com/blog/2017/09/24/the-sql-i-love-part-1-scanning-large-table/
- https://slack.engineering/evolving-api-pagination-at-slack-1c1f644f8e12
- https://momjian.us/main/blogs/pgblog/2020.html#August_17_2020
那么,有没有计划支持这种分页方式,例如通过 Pageable<KeyType>
和 getKey()
然后将其合并到 SQLs WHERE 子句中?
团队讨论了这种可能性,虽然不紧急,但我们最终还是愿意提供。
第一步是在 Spring Data Commons 中为此提供支持,即独立于持久性存储 API。这个问题是 DATACMNS-1729
据我所知,Pageable class supports only LIMIT/OFFSET based paging. However, while being a quite universal solution, it comes with some downsides as outlined here https://momjian.us/main/blogs/pgblog/2020.html#August_10_2020
Keyset Pagination(又名 Seek Method 或 Cursor-based Pagination)有一些好处在并发数据插入和删除期间的性能和行为方面。详情见
- https://use-the-index-luke.com/no-offset
- http://allyouneedisbackend.com/blog/2017/09/24/the-sql-i-love-part-1-scanning-large-table/
- https://slack.engineering/evolving-api-pagination-at-slack-1c1f644f8e12
- https://momjian.us/main/blogs/pgblog/2020.html#August_17_2020
那么,有没有计划支持这种分页方式,例如通过 Pageable<KeyType>
和 getKey()
然后将其合并到 SQLs WHERE 子句中?
团队讨论了这种可能性,虽然不紧急,但我们最终还是愿意提供。
第一步是在 Spring Data Commons 中为此提供支持,即独立于持久性存储 API。这个问题是 DATACMNS-1729