<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/offset-keyset-and-cursor-pagination-in-net-when-to-use-each-nu8z07czy" -->

---
title: Offset, Keyset, and Cursor Pagination in .NET: When to...
description: A comparison of three pagination strategies for .NET APIs using EF Core: offset pagination (Skip/Take), keyset pagination (WHERE clause on last seen key), and...
canonical: https://daily.dev/posts/offset-keyset-and-cursor-pagination-in-net-when-to-use-each-nu8z07czy
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Offset, Keyset, and Cursor Pagination in .NET: When to Use Each | daily.dev
og:description: A comparison of three pagination strategies for .NET APIs using EF Core: offset pagination (Skip/Take), keyset pagination (WHERE clause on last seen key), and...
og:url: https://daily.dev/posts/offset-keyset-and-cursor-pagination-in-net-when-to-use-each-nu8z07czy
og:image: https://api.daily.dev/og/posts/nU8z07czY.png
og:image:alt: Offset, Keyset, and Cursor Pagination in .NET: When to Use Each
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Offset, Keyset, and Cursor Pagination in .NET: When to Use Each

**[Waseem .NET Newsletter](https://daily.dev/sources/mwaseemzakir)** · 8 min read · 12 upvotes · 2 comments

## Summary

A comparison of three pagination strategies for .NET APIs using EF Core: offset pagination (Skip/Take), keyset pagination (WHERE clause on last seen key), and cursor pagination (keyset with an opaque token). Offset is simple but degrades at scale and can skip or duplicate rows under concurrent writes; keyset avoids scanning skipped rows via indexed seeks but can't jump to arbitrary pages and gets messy with multi-column sorting since EF Core can't translate compact tuple comparisons into LINQ; cursor pagination wraps keyset logic behind a base64-encoded token so clients don't see the internal sort key. Includes EF Core/LINQ code samples, generated SQL, and guidance on when to pick each approach based on table size and navigation needs.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://mwaseemzakir.substack.com/p/offset-keyset-and-cursor-pagination>

## Questions this post answers

### When should I use keyset pagination instead of offset pagination in EF Core?

Use keyset pagination when paging through large or growing tables where consistent performance matters more than jump-to-page support. It replaces the OFFSET clause with a WHERE clause filtering on the last seen key (e.g. WHERE Id > lastId), letting SQL Server seek via an index instead of scanning past skipped rows, so performance stays flat whether it's page 2 or page 20,000.

_Comparing pagination strategies before scaling an API is easier with technical breakdowns like this on daily.dev._

### Why can't I write a compact multi-column keyset pagination query in EF Core LINQ?

EF Core cannot yet translate the compact tuple comparison WHERE (CreatedAt, Id) > (@lastCreatedAt, @lastId) into LINQ, even though most databases support that syntax directly. Developers instead have to manually chain OR conditions to replicate the same comparison logic when sorting by multiple columns for keyset pagination.

_Developers hitting EF Core's LINQ limits on multi-column sorting can find workarounds through daily.dev._

### What is the difference between keyset pagination and cursor pagination?

Keyset pagination is the database and query strategy, filtering with a WHERE clause on the last seen key such as Id, while cursor pagination is the API abstraction built on top of it that hides that key behind an opaque, base64-encoded token like cursor=MjA=. The underlying SQL query is effectively identical; cursor pagination just avoids exposing the internal sort key in the API contract.

_daily.dev helps API designers weigh keyset versus cursor pagination tradeoffs for public-facing endpoints._

## Community discussion

Top comments from developers on daily.dev.

**@trevorsuna** · 1 upvotes

> Keyset pagination is usually the practical default for large, changing tables, but the sort key must be stable and unique. Appending an ID as a tie-breaker and versioning the opaque cursor helps avoid duplicates while leaving room to change its internal shape later.

**@agustinbarrientos** · 0 upvotes

> What happens when two rows share the same CreatedAt between cursor requests, and do both still appear exactly once?

## Similar posts on daily.dev

- [Pagination in Entity Framework Core: Why Skip/Take Falls Apart on Hot Tables - Chris Woody Woodruff](https://daily.dev/posts/pagination-in-entity-framework-core-why-skip-take-falls-apart-on-hot-tables---chris-woody-woodruff-la973vnde) · We Are .NET · 1 upvotes · 0 comments
- [Offset and Keyset Pagination with Spring Data JPA](https://daily.dev/posts/offset-and-keyset-pagination-with-spring-data-jpa-nya5hmupa) · Jakarta EE · 0 upvotes · 0 comments
- [Stop Crashing Your Servers: The Ultimate Guide to Pagination \(Offset vs. Cursor\)](https://daily.dev/posts/stop-crashing-your-servers-the-ultimate-guide-to-pagination-offset-vs-cursor--pzqbdxfml) · Medium · 0 upvotes · 0 comments
- [Pagination patterns in Amazon Aurora DSQL](https://daily.dev/posts/pagination-patterns-in-amazon-aurora-dsql-y4q8wsmku) · AWS Database Blog · 0 upvotes · 0 comments

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#c#](https://daily.dev/tags/c#), [#microsoft-sql-server](https://daily.dev/tags/microsoft-sql-server)

[View this post on daily.dev](https://daily.dev/posts/offset-keyset-and-cursor-pagination-in-net-when-to-use-each-nu8z07czy)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Offset, Keyset, and Cursor Pagination in .NET: When to Use Each","url":"https://daily.dev/posts/offset-keyset-and-cursor-pagination-in-net-when-to-use-each-nu8z07czy","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/offset-keyset-and-cursor-pagination-in-net-when-to-use-each-nu8z07czy"},"datePublished":"2026-08-29T05:10:34.699Z","dateModified":"2026-09-14T09:11:03.843Z","description":"A comparison of three pagination strategies for .NET APIs using EF Core: offset pagination (Skip/Take), keyset pagination (WHERE clause on last seen key), and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d868c5fa8d469f18ec891489f8278a55?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d868c5fa8d469f18ec891489f8278a55?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Waseem .NET Newsletter","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Waseem .NET Newsletter","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/a10ec420048a48bf86f6889f2de88180","url":"https://daily.dev/sources/mwaseemzakir"},"commentCount":2,"discussionUrl":"https://daily.dev/posts/offset-keyset-and-cursor-pagination-in-net-when-to-use-each-nu8z07czy","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":12},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"keywords":"architecture,c#,microsoft-sql-server","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Waseem .NET Newsletter","item":"https://daily.dev/sources/mwaseemzakir"},{"@type":"ListItem","position":3,"name":"Offset, Keyset, and Cursor Pagination in .NET: When to Use Each"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/offset-keyset-and-cursor-pagination-in-net-when-to-use-each-nu8z07czy","comment":[{"@type":"Comment","text":"Keyset pagination is usually the practical default for large, changing tables, but the sort key must be stable and unique. Appending an ID as a tie-breaker and versioning the opaque cursor helps avoid duplicates while leaving room to change its internal shape later.","datePublished":"2026-09-01T02:43:02.434Z","url":"https://daily.dev/posts/nU8z07czY#c-Lu3Uh2XgJ","author":{"@type":"Person","name":"Trevor Suna","url":"https://daily.dev/trevorsuna","image":"https://media.daily.dev/image/upload/s--dZ7gXxpp--/f_auto/v1784081551/avatars/avatar_EMoP47rpuw8DNjhp6R1b6?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"What happens when two rows share the same CreatedAt between cursor requests, and do both still appear exactly once?","datePublished":"2026-08-30T13:08:48.604Z","url":"https://daily.dev/posts/nU8z07czY#c-DcEL9SAhR","author":{"@type":"Person","name":"Agustin Barrientos","url":"https://daily.dev/agustinbarrientos","image":"https://media.daily.dev/image/upload/s--5ayxQnqn--/f_auto/v1788281802/avatars/avatar_wQYYVe5Tbj0NJ7C7qPoa8?_a=BAMAMicg0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/offset-keyset-and-cursor-pagination-in-net-when-to-use-each-nu8z07czy#faq","mainEntity":[{"@type":"Question","name":"When should I use keyset pagination instead of offset pagination in EF Core?","acceptedAnswer":{"@type":"Answer","text":"Use keyset pagination when paging through large or growing tables where consistent performance matters more than jump-to-page support. It replaces the OFFSET clause with a WHERE clause filtering on the last seen key (e.g. WHERE Id \u003e lastId), letting SQL Server seek via an index instead of scanning past skipped rows, so performance stays flat whether it's page 2 or page 20,000. Comparing pagination strategies before scaling an API is easier with technical breakdowns like this on daily.dev."}},{"@type":"Question","name":"Why can't I write a compact multi-column keyset pagination query in EF Core LINQ?","acceptedAnswer":{"@type":"Answer","text":"EF Core cannot yet translate the compact tuple comparison WHERE (CreatedAt, Id) \u003e (@lastCreatedAt, @lastId) into LINQ, even though most databases support that syntax directly. Developers instead have to manually chain OR conditions to replicate the same comparison logic when sorting by multiple columns for keyset pagination. Developers hitting EF Core's LINQ limits on multi-column sorting can find workarounds through daily.dev."}},{"@type":"Question","name":"What is the difference between keyset pagination and cursor pagination?","acceptedAnswer":{"@type":"Answer","text":"Keyset pagination is the database and query strategy, filtering with a WHERE clause on the last seen key such as Id, while cursor pagination is the API abstraction built on top of it that hides that key behind an opaque, base64-encoded token like cursor=MjA=. The underlying SQL query is effectively identical; cursor pagination just avoids exposing the internal sort key in the API contract. daily.dev helps API designers weigh keyset versus cursor pagination tradeoffs for public-facing endpoints."}}]}
```

