Reactive PgSql/MySql clients and batching.

87 views
Skip to first unread message

Chandra R.

unread,
Feb 14, 2021, 11:10:48 PM2/14/21
to vert.x
Hello
I've been playing around with the vert.x reactive mysql and Postgres clients. I have managed to get most of the functionality working, but I had a couple of questions.

I have a use-case where I would like to perform the following operations after obtaining a connection from the pool:
1) Set a session variable for the connection
2) Execute my query (either a simple or a prepared query) on the connection.

Currently, the way I'm doing it is by sending 2 queries (i.e. set the session variable, and in the response handler, second the second query).

Is there a way to execute both these statements as part of a single "query" call? I remember reading that the vertx-sql-client has a batch API, does it exist for the reactive mysql/pgsql clients?

Alternatively, is there a way I can specify the session variable option for all connections in a pool i.e. via PgConnect/MySqlConnectOptions?

Thirdly, I see that there is a pipeline limit option for PgSql. Does Mysql not support pipelining/batching?

Thanks a lot for your support

Julien Viet

unread,
Feb 15, 2021, 4:46:01 AM2/15/21
to vert.x
Hi,

On Mon, Feb 15, 2021 at 5:10 AM Chandra R. <mahe...@gmail.com> wrote:
Hello
I've been playing around with the vert.x reactive mysql and Postgres clients. I have managed to get most of the functionality working, but I had a couple of questions.

I have a use-case where I would like to perform the following operations after obtaining a connection from the pool:
1) Set a session variable for the connection
2) Execute my query (either a simple or a prepared query) on the connection.

Currently, the way I'm doing it is by sending 2 queries (i.e. set the session variable, and in the response handler, second the second query).

Is there a way to execute both these statements as part of a single "query" call? I remember reading that the vertx-sql-client has a batch API, does it exist for the reactive mysql/pgsql clients?

batching assumes that the query is the same and the parameter change
 

Alternatively, is there a way I can specify the session variable option for all connections in a pool i.e. via PgConnect/MySqlConnectOptions?

we are planning on providing a factory method for the pool, that would allow you to perform some connection initialization before it gets in the pool, would it work for you ? or do you need to use a different value each time a connection is acquired ?
 

Thirdly, I see that there is a pipeline limit option for PgSql. Does Mysql not support pipelining/batching?

pipelining would be the ideal way to do it I think.

not yet, but Billy is contributing the feature: https://github.com/eclipse-vertx/vertx-sql-client/pull/875
 

Thanks a lot for your support

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/7e2615a6-6fe7-4aaf-b34f-42d6e5bb7c14n%40googlegroups.com.

Chandra R.

unread,
Feb 15, 2021, 2:10:25 PM2/15/21
to vert.x
Thanks for the response!

1) Yes, if there's a factory method for the pool that allows us to set session variables (name:value pairs) while initializing the pool, that would work too!
Reply all
Reply to author
Forward
0 new messages