I compared OFFSET-based pagination with keyset (cursor) pagination in PostgreSQL using EXPLAIN ANALYZE.
The goal was to understand why OFFSET pagination is considered bad, even though it doesn’t look slow on small datasets.
Tests were run on https://neon.com/postgresql/postgresql-getting-started/postgresql-sample-database dvdrental database rental table (has index on rental_id).
EXPLAIN ANALYZE
SELECT *
FROM rental
ORDER BY rental_id
OFFSET 10000
LIMIT 10;

EXPLAIN ANALYZE
SELECT *
FROM rental
WHERE rental_id >= 10000
ORDER BY rental_id
LIMIT 10;
