Recommended way of doing a page offset?

Hi all,

I have an HTML table and I would like to be able to jump to the Nth page quickly.
Here is the SQL query as a reference:

SELECT * FROM users LIMIT 100 OFFSET 20

What is the recommended way of doing this in FQL?
I could only find a “before” and “after” setting.

Thanks.

This is easily translatable into fauna (assuming $LIMIT < 100k): Drop(Paginate(....., {size: $LIMIT}), $OFFSET). “But, Ben!” I hear you exclaim: “isn’t that really inefficient?”. Yes it is, and so is the SQL. What you probably want to do is keyset pagination, which is efficient, and also representable in fauna using the Range function, or using the before and after cursors.

3 Likes

Hi ben, thanks a lot for your reply. :raised_hands:
Will try out your suggestions!
(I am aware SQL offsets do get very slow on large tables.)

That’s cool. Sorry if this came off as preachy, we just get a lot of questions about offset / limit pagination and I wanted to cover future readers as well!

1 Like