Why Use Cursor Based Pagination Over Offset Pagination?

Atakan Demircioğlu
3 min read1 day ago

Generally, we use custom offset-based pagination (the traditional method), and cursor-based pagination is another method used to create a pagination.

It provides a smooth and efficient way to navigate through large amounts of data.

In this article, we will talk about the cursor-based pagination approach.

What is Cursor-Based Pagination?

Cursor-based pagination is a method of paginating data based on a cursor (a pointer or identifier) rather than simple page numbers or offsets.

The cursor represents the position of the current data and this allows to the application to fetch the next or previous results.

Unlike the traditional (offset-based) pagination it has some pros (like performance) but also it has some downsides like (can’t directly fetch to the 20. page for ex.)

How it works?

A query is made for the first set of results, often with a LIMIT or similar constraints.

We chose a cursor typically a unique identifier or a value based on some attribute…

--

--

Atakan Demircioğlu
Atakan Demircioğlu

Written by Atakan Demircioğlu

Passionate about blogging and sharing insights on tech, web development, and beyond. Join me on this digital journey! 🚀

No responses yet