基于游标的分页和UUID

基于游标的分页和UUID

问题描述:

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)

我正在考虑实现UUID来代替自动增量ID,并想知道我是否或如何整合 基于光标的UUID分页。 p>

通过简单的自动增量,我可以简单地对当前ID进行加/减来查找我的下一个/上一个,但这对UUID来说是不可能的。 p>

将时间戳列上的光标用作created_on / modified_on更合理吗? p>

我正在使用Laravel 4,PhpLeague \ Fractal( https://github.com/thephpleague/fractal )我正在考虑引进Rhumsaa \ Uuid( https://github.com/ramsey/uuid ) p> div>

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.