OFFSET using a GUID kind of ID
Don't use offset - it has to read all the rows to skip them.

If you order rows for pagination by created_at, then thats the column you need to use.

First page:

SELECT ... FROM table
ORDER BY created_at, id
LIMIT N + 1;


The +1 gives you a peek to the next page - you can quickly decide if next page exists and where does it start. If created_at is not guaranteed to be unique, adding the ID to the ordering helps keep it stable.

Next page:

SELECT ... FROM table
WHERE created_at &gt;= &lt;(x+1)th created_at from previous page&gt;
    AND id &gt;= &lt;(x+1)th id from previous page&gt;
ORDER BY created_at, id
LIMIT N + 1;


You use the extra item from fetching the previous page to quickly find the start of current page using the ordering index to get new page.