Cursor Pagination & Ecto

Any thoughts about cursor pagination and databases and Elixir?

This library looks promising. I am wondering whether there are any angles I am missing…


I found the normal OFFSET / LIMIT solutions extremely lacking and inefficient (as has been explained a number of times on the net) and the cursor implementation seems a bit alien and is still not 100% clear to me – those are not really good arguments at all though.

(Also, does this cursor persist between requests? I am supposing yes but the GitHub README doesn’t make it clear. I wonder if you can assign the cursor in a Plug.Conn.)

That being said, I found this library much more satisfying: The name is a bit misleading since they don’t use cursors; they use a field (by default id) to fetch the next pages. It’s basically “get me records whose id is greater than the biggest one from the previous page and limit the result set to 50”, which performs better.

But I have no strong argument against Postgres cursors per se.