1

or, in other words, is it possible to do this:

[databases]
db1   = user=usr1 pool_size=10 application_name=app1 dbname=data1 ...
db1   = user=usr2 pool_size=20 application_name=app2 dbname=data1 ...

such that when usr1 attempts to connect to db1, they have pool_size of 10 while usr2 attempting to connect to same pool has 20?

1 Answer 1

2

That won't work for at least two reasons. The two rows are keyed alike, so only the 2nd will take affect. And those lines are not testing what the user is, they are commanding what the user will be. So connections coming in to pgbouncer for 'db1' will go to the real database as user 'usr2' (regardless of the specified incoming user) and as dbname 'data1'

To do what you seem to want, you would need something like:

[databases]
db1 =  dbname=data1
[users]
usr1 = max_user_connections=10
usr2 = max_user_connections=20
2
  • thanks for that - i was hoping to control the application_name but that k/v is only available in the databases section. i guess i'll just make sure connection strings have correct application name property although ive noticed that devs have a tendency to skip that property
    – Reinsbrain
    Commented Aug 11, 2021 at 5:23
  • Yeah I was noticing the paucity of options for [users] and wondering how hard it would be to add some more into the code. Here at least the user name is different so you should be able to distinguish that way.
    – jjanes
    Commented Aug 11, 2021 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.