Our great sponsors
-
> So cursor pagination is just keyset pagination, except instead of using a column value directly you use an opaque string that gets translated back to a column value.
HashIds is a popular solution if those columns are numerical or can be represented numerically (e.g. timestamp).
-
EF core with PostgreSQL now supports it
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
>How do you find on the backend if a page is the last one?
Laravel has a manual pagination class called LengthAwarePaginator [1] that accomplishes this by taking the total items (run count(*) on the query) as one of the arguments. It calculates the number of pages based on the count, and per-page # of results and returns an object with a last page property. There's some slight overhead to this and it can be tricky if you have a bunch of subqueries, but I've used it on tables with millions of records.
[1] https://github.com/laravel/framework/blob/9.x/src/Illuminate...