drewolson/scrivener_ecto

Avoid OFFSET when possible

vhf opened this issue · 3 comments

vhf commented

(Following up on #20 )

Detecting if there's an order_by and using a combination of WHERE pk > :last_id and LIMIT :page_size seems like a good approach.

What do you think?

@vhf this only works if the schema is using an integer-based, ascending primary id. It wouldn't work for applications using, say, UUIDs as identifiers. I think cursor-based pagination is a great approach, but I think it should live in a separate, specific repo that implements the Scrivener.Paginator protocol with this new technique.

@drewolson - Do you think this should be a separate module, or included within scrivener_ecto?

I'm interested in helping with this, and would be happy to contribute back code for this.