postgresml / pgcat

PostgreSQL pooler with sharding, load balancing and failover support.
MIT License
2.7k stars 160 forks source link

Add support for automatic pool (similar to pgbouncer) #362

Open pinaraf opened 1 year ago

pinaraf commented 1 year ago

Is your feature request related to a problem? Please describe. For some applications, it may not be possible to list all databases the application can connect to (for instance when each customer has his own database). For these, it's better to use a feature similar to the automatic pool in pgbouncer, cf. https://www.pgbouncer.org/config.html section databases.

Describe the solution you'd like Be able to describe an automatic pool generator in the configuration.

Describe alternatives you've considered None known

Additional context None

levkk commented 1 year ago

Hi there,

I've never used that feature of PgBouncer. Could you give me an example of how it works?

Thanks!

pinaraf commented 1 year ago

Hi

In pgbouncer.ini:

[databases]
* = host=my.server.org port=5432

When a client connects to the bouncer and asks for the database demo, it will spawn a new pool, named demo, for the database demo on my.server.org:5432. If the client disconnects, the pool will remain "forever" or until autodb_idle_timeout is reached. The usual server_idle_timeout and server_lifetime rules apply.

Regards

adriangb commented 5 months ago

+1 for this feature. I specifically need users wildcards.

AndrewJackson2020 commented 2 months ago

+1 for this feature, without it there ends up being a lot of boilerplate and manual upkeep in an environment with a large number of databases and users.

strelkovia commented 1 month ago

Hi +1 for this feature