Reactive driver for MariaDB

I'm using Quarkus + Munity + Reactive Driver for MariaDB. I have a question to understand how reactive driver is working.

I want to process 20_000_000 entries stored in my database. For that, I want to stream entries efficiently to apply a non-blocking transformation.

select COUNT(*) from entries -> 20_000_000 

How the MariaDB reactive driver is working?

It opens a TCP connection and fetch all entries -> a nightmare and blocking processing :(

It opens a connection and it requests a limited package of entries, and it streams them (like a paging) -> not very efficient

It opens a connection and wait to receive an event to fetch one by one entry -> reactive way. ...

Please could you confirm or explain how it's working (documentation, schema, ...)?

Many thanks for your help


The Reactive Client for MySQL will fetch all rows if you execute a query or prepared query.

For large amounts of rows, it's better to use the streaming API:

Multi<Row> rows = connection.prepare("SELECT * FROM users WHERE age > ?")
            .onItem().transformToMulti(ps -> ps.createStream(50, Tuple.of(18)).toMulti());

For the amount of rows you're dealing with, it might be interesting to consider using a stored procedure working with the data where it is instead of sending it over the network. Your mileage may vary.