I have implemented pagination in a project using the method startAfter.
The Query comprises the result between 2 dates and limited to 50 .
My question is : In case i have 5000 records to paginate, that makes it 100 pages to navigate, how can i show the user on which page they are at?
Example Page 3 of 100.
Do I have to start by querying the database to give me that snapshot size of 500 then keep a reference to the size and finally build my second query with limit 50 ?
If so, will I pay for both queries ? (The first one to get the overall snapshot size and the second one which is the navigable query to be limited to 50 ).
If there is a better, concise and economic way, please let me know.
Thanks,
Jean