Skip to content

Commit

Permalink
fix(pagination): Explain what happens when cursor does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
janpio authored Oct 29, 2023
1 parent 34eac16 commit 702faf9
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ If you guess the value of the next cursor, you will page to an unknown location

No, cursor pagination does not use cursors in the underlying database ([e.g. PostgreSQL](https://www.postgresql.org/docs/9.2/plpgsql-cursors.html)).

#### What happens if the cursor value does not exist?

Using a nonexistent cursor returns `null`. Prisma does not locate adjacent values.

### ✔ Pros of cursor-based pagination

- Cursor-based pagination **scales**. The underlying SQL does not use `OFFSET`, but instead queries all `Post` records with an ID greater than the value of `cursor`.
Expand Down

0 comments on commit 702faf9

Please sign in to comment.