Another thing I'm wondering now is the foolowing: I'm implementing an api with a traditional paginat

Another thing I'm wondering now is the foolowing:
I'm implementing an api with a traditional pagination using
offset
,
limit
(so no cursors).
Responses also include the
totalCount

Currently I'm executing 2 queries:
- get the actual records for the given page (e.g. with page size
10
this will result in 10 rows being queried.
- the count query (so when having 1000 rows in the D1 database this will result in 1000 rows read)
together this will result in 1010 rows being read
I could in fact just query all rows (1000!! reads) and then do the filtering (pagination) in the code....
Was this page helpful?