spring-data-relational icon indicating copy to clipboard operation
spring-data-relational copied to clipboard

KeySet-based pagination

Open yangwenliang123 opened this issue 3 years ago • 5 comments

ReactiveQueryByExampleExecutor when can range lookup be supported,Because my paging optimization may be id > 100 limit 20

yangwenliang123 avatar Jul 26 '22 03:07 yangwenliang123

Care to elaborate on what you're trying to achieve? The initial description isn't helpful. Feel free to post a bit of code to help illustrate how you're using the repository.

mp911de avatar Jul 26 '22 06:07 mp911de

The default paging implementation is select * from table limit 0,10. The higher the offset, the longer the query time I should do this: select * from table where id > 100 limit 20. this is a pointer based paging. But it depends on range query, but I see that reactivequerybyexampleexecutor does not support range query

yangwenliang123 avatar Jul 26 '22 06:07 yangwenliang123

Thanks for the details. What you're referring to is known as key-set based pagination. It isn't tied to query by example so I updated the title to reflect that aspect. Before we can provide key-set pagination, we need to have some infrastructure in place so https://github.com/spring-projects/spring-data-commons/issues/2151 is a pre-requisite.

mp911de avatar Jul 26 '22 06:07 mp911de

If the sample query supports range search, the paging based on ketset will be solved automatically. For example: the paging condition is always pagerequest of (0, PageSize), The query criteria are: user user = new user(); user.setId(10L); Example<User> userExample = Example.of(user);

yangwenliang123 avatar Jul 26 '22 06:07 yangwenliang123

Since this metiones ReactiveQueryByExampleExecutor I marked this as in:R2DBC although an analogous feature would be nice for all JDBC as well.

schauder avatar Aug 25 '22 13:08 schauder

Closing as duplicate of #1605. Keyset-based pagination will come along with offset-based scrolling.

mp911de avatar Sep 13 '23 13:09 mp911de