1

I've set up a sample project using spring boot, webflux, and r2dbc. I've been able to stream rows from a postgres db table to the client.

Is there a memory bottleneck on this server implementation (for storing the results of the query)? Do the rows stream through?

PS I'm not claiming any level of quality on this, I know pagination and so on would be essential, just wondering about how the db query interacts with the reactive framework.

1 Answers1

0

Pagination is not essential with R2DBC. If you have a lot of rows to process you can issue a single query instead of fetching batches. The driver uses back-pressure to allow flow control so it does not overwhelm your application. You could read here about how backpressure is applied on such queries.

lkatiforis
  • 5,703
  • 2
  • 16
  • 35
  • I think this makes sense for a business process that must process all the rows, but to supply data to a front-end application, wouldn't it make sense to provide a paginated interface to minimize data transfer and localize data processing to the db instance? – Segev Malool Nov 25 '21 at 19:08
  • @Segev Malool Absolutely. If you want to fetch a fixed amount of rows then use paganation. – lkatiforis Nov 25 '21 at 19:55