1

i connect to Postgresql via JDBC through pgbouncer with transaction pooling mode enabled. As far as I know in this mode pgbouncer can share same connection for several client without breaking session. So several clients may work within a single session sequentially, one by another. The question is does pgbouncer care about reseting session parameters when it detach one client from a connection and attach another client to this connection?

In particular, my app get connection and then issues something like this:

executeQuery(connection,"select set_config('myapp.user','fonar101',false)");
..../*other actions*/
commit(connection); 

After commit pgbouncer can detach my app from connection and get it back to its pool, right? So,

  1. if I issue another statements after commit they will probably be executed within another session with incorrect values of session parameters
  2. pgbouncer can attach another client to that connection and that client will proceed with again incorrect session settings

How does pgbouncer care about this things?

2 Answers2

1

I'd say the opposite:

https://pgbouncer.github.io/config.html

transaction

Server is released back to pool after transaction finishes.

Which means that when you SET SESSION (default for SET), without specifying SET LOCAL, you change settings for all transactions that share the session in the pool...

Vao Tsun
  • 47,234
  • 13
  • 100
  • 132
0

According pgbouncer docs it doesnt support SET/RESET and ON COMMIT DROP for temp tables in transaction pooling mode.

  • 1
    This is not entirely true. See https://www.postgresql.org/message-id/155582596.4848118.1418225874525.JavaMail.yahoo%40jws100188.mail.ne1.yahoo.com – mkurz Apr 17 '18 at 16:35