Member-only story
Is offset pagination dead? Why cursor pagination is taking over
The reason Facebook says Cursor Pagination is the Way to Go

Facebook’s developer page said it best:
“Cursor-based pagination is the most efficient method of paging and should always be used where possible.”
So what exactly is pagination?
Pagination is the process of separating data into sets. Just like the pages of a book.
There are two main ways to implement pagination on a website. But which one is better? Let’s explore both options and see.
Offset Pagination
This method has been used effectively for decades. It leverages a SQL query containing an OFFSET value like this:
SELECT * FROM table
ORDER BY timestamp
OFFSET 10
LIMIT 5
It is most often paired with a frontend that uses explicit pages that you toggle through, much like one would flip through the pages of a book.
Cursor Pagination
This method leverages a SQL query containing a comparison operator (i.e. <
or >
) (usually comparing timestamps) like this:
SELECT * FROM table
WHERE…