Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

On this pageOverview

Pagination (Prisma ORM v7) (/docs/orm/v7/prisma-client/queries/pagination)

For the complete Prisma documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL.

Learn how to paginate Prisma Client query results with offset pagination and cursor-based pagination.

Location: ORM > v7 > Prisma Client > Queries > Pagination

Prisma Client supports both offset pagination and cursor-based pagination.

Use skip and take when you need page numbers or shallow navigation through a result set:

TypeScript
const posts = await prisma.post.findMany({
  skip: 20,
  take: 10,
});

Offset pagination is straightforward, but it becomes more expensive as the offset grows.

Use cursor and take when you want stable, scalable pagination for feeds, timelines, or large datasets:

TypeScript
const firstPage = await prisma.post.findMany({
  take: 10,
  orderBy: {
    id: "asc",
  },
});

const lastPost = firstPage[firstPage.length - 1];

const nextPage = lastPost
  ? await prisma.post.findMany({
      take: 10,
      skip: 1,
      cursor: {
        id: lastPost.id,
      },
      orderBy: {
        id: "asc",
      },
    })
  : [];
  • Use offset pagination when users need to jump directly to a numbered page.
  • Use cursor-based pagination when you care more about performance and consistency as the dataset grows.
  • Aggregation, grouping, and summarizing: Use Prisma Client to aggregate, group by, count, and select distinct.
  • CRUD: Learn how to perform create, read, update, and delete operations
  • Excluding fields: Learn how to exclude fields from Prisma Client results with the omit option.
  • Filtering and sorting: Learn how to filter Prisma Client queries with where and sort results with orderBy.
  • Full-text search: Learn how to search text fields with Prisma Client using your database's native full-text search support.
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu