Member-only story

Is offset pagination dead? Why cursor pagination is taking over

The reason Facebook says Cursor Pagination is the Way to Go

Megan C.
UX Collective
10 min readSep 13, 2019

Photo by Gaspar Uhas on Unsplash

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

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in UX Collective

We believe designers are thinkers as much as they are makers. Curated stories on UX, Visual & Product Design. https://linktr.ee/uxc

Written by Megan C.

Just a software girl livin’ in a startup world | Took the midnight train goin’ to Google | UCSB Master’s in Mechanical Engineering

Responses (7)

What are your thoughts?

You absolutely can use cursor pagination on first and last name, even though they aren’t unique. You just add the primary key to the sort columns and cursors, so that if there are multiple people with the same name, then the primary key breaks the…

Great Article, But what about switch direct between pages??
for example, in page # 2 and navigate to page # 5

I didn't see any mention of SEO. We're considering using this on websites, would it be worse or better for SEO?