Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: Investigate supporting simple patterns for keyset pagination #9115

Closed
divega opened this issue Jul 8, 2017 · 6 comments
Closed

Query: Investigate supporting simple patterns for keyset pagination #9115

divega opened this issue Jul 8, 2017 · 6 comments
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed.

Comments

@divega
Copy link
Contributor

divega commented Jul 8, 2017

This can perform better than paging based on OFFSET. For more information, see:

@erikest
Copy link

erikest commented Mar 28, 2019

just read use-the-index-luke and immediately wondered what the implementation in EF/EF Core was and here I am.

As the article mentions, the technique can't really replace skip/take because it can't jump to an exact 'starting point' based on the implicit row number from the sort order - but, it would be an excellent feature for async yield of a large result set, broken up into multiple queries, where you can choose your 'chunk/page size' and keep yielding new chunks.

As in, a KeyPage function that returns an IAsyncEnumerable<>

I'd love to write code like this, for example:

IAsyncEnumerable<IEnumerable<Foo>> pages =  _context.Foos.Where(foo=>foo.Total>20).OrderBy(foo=>foo.Date).KeyPage(pageSize: 100);

await foreach(var page in pages) {
    gridItems.AddRange(page);
}

or


void ShowMoreResults(IAsyncEnumerable<IEnumerable<Foo>> pages) {
    if (await pages.MoveNextAsync())
        gridItems.AddRange(pages.Current);
}

@MoienTajik
Copy link
Contributor

Any news on this topic?

@ajcvickers
Copy link
Member

@MoienTajik This issue is in the Backlog milestone. This means that it is not planned for the next release (EF Core 5.0). We will re-assess the backlog following the this release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.

@mrahhal
Copy link

mrahhal commented Sep 4, 2020

Hey. I have fully implemented keyset pagination for EFCore in a package here.

I took some liberty in designing the package but I imagine there will be certain requirements for how the api should look like in EFCore. I'd be happy if I could help bringing this in.

@roji
Copy link
Member

roji commented Dec 1, 2021

Allowing users to express row value comparisons - which are an important part of keyset pagination - is tracked by #26822.

@roji
Copy link
Member

roji commented Dec 9, 2021

We looked into this, and we can indeed add row value comparisons to make multi-key keyset pagination more efficient (#26822). Beyond that we don't think there's anything we need to build: the building blocks are there, and keyset pagination can be expressed with OrderBy and Where operators.

There may be room for a higher-level pagination API, but at least at this point we think this can be implemented outside of EF Core, over building blocks we provide (see MR.EntityFrameworkCore.KeysetPagination as an example).

@roji roji closed this as completed Dec 9, 2021
@roji roji removed this from the Backlog milestone Dec 9, 2021
@ajcvickers ajcvickers added the closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed. label Mar 10, 2022
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-out-of-scope This is not something that will be fixed/implemented and the issue is closed.
Projects
None yet
Development

No branches or pull requests

7 participants