The ask is :
- to run a SELECT statement (with offset and limit)
- to run a COUNT statement (without offset & limit)
Now, we want to run these two queries at once in r2dbc in an asynchronous manner(so that we send and get the result in same time, not to wait for one to finish executing and then send another, to make use of reactive programming and reduce time)
This is to implement pagination so that we can tell the user how many pages are there after the current page.
This is how we're sending the select query :
return r2dbcTemplate.getDatabaseClient() .sql(query) .fetch() .all() .collectList();
the variable query contains the SELECT query
Any ways to implement the above stated ask ?
Tech stack used : Application -> Java 17 & Spring boot DB -> Postgres
We've have tried sending the two queries in a synchronous manner (one after the other), but it defeats the purpose of reactive approach.