Cursor based pagination and UUID

4.7k views Asked by At

I am looking at implementing UUID'd in place of auto-increment id and was wondering if or how I might integrate cursor based pagination with UUID's.

With simple auto-increments I can simply add/subtract on the current ID to find my next/previous but this is not possible with UUID's.

Would it make more sense to use the cursor on a timestamp column suck as created_on / modified_on?

I am working with Laravel 4, PhpLeague\Fractal (https://github.com/thephpleague/fractal) and am looking at bringing in Rhumsaa\Uuid (https://github.com/ramsey/uuid)

1

There are 1 answers

2
Belda On BEST ANSWER

Ideal would be to have a column with automatic datetime/timestamp and use that as an cursor target. Do keep in mind however to have proper index on that field.