Skip to content

Commit

Permalink
Update pagination.md (#3917)
Browse files Browse the repository at this point in the history
  • Loading branch information
glen-84 authored Jul 2, 2022
1 parent 40e69ef commit 63a5492
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions entity-framework/core/querying/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Pagination refers to retrieving results in pages, rather than all at once; this
## Offset pagination

A common way to implement pagination with databases is to use the `Skip` and `Take` (`OFFSET` and `LIMIT` in SQL). Given a a page size of 10 results, the third page can be fetched with EF Core as follows:
A common way to implement pagination with databases is to use the `Skip` and `Take` (`OFFSET` and `LIMIT` in SQL). Given a page size of 10 results, the third page can be fetched with EF Core as follows:

[!code-csharp[Main](../../../samples/core/Querying/Pagination/Program.cs?name=OffsetPagination&highlight=4)]

Expand All @@ -25,7 +25,7 @@ Unfortunately, while this technique is very intuitive, it also has some severe s

## Keyset pagination

The recommended alternative to offset-based pagination - sometimes called *keyset pagination* or *seek-based pagination* - is simply use a `WHERE` clause to skip rows, instead of an offset. This means remember the relevant values from the last entry fetched (instead of its offset), and to ask for the next rows after that row. For example, assuming the last entry in the last page we fetched had an ID value of 55, we'd simply do the following:
The recommended alternative to offset-based pagination - sometimes called *keyset pagination* or *seek-based pagination* - is to simply use a `WHERE` clause to skip rows, instead of an offset. This means remember the relevant values from the last entry fetched (instead of its offset), and to ask for the next rows after that row. For example, assuming the last entry in the last page we fetched had an ID value of 55, we'd simply do the following:

[!code-csharp[Main](../../../samples/core/Querying/Pagination/Program.cs?name=KeySetPagination&highlight=4)]

Expand Down

0 comments on commit 63a5492

Please sign in to comment.