-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting multiple databases with libpq #2798
Comments
What I have prototyped is something similar: Let hasql-pool implement a kind of a multi-pool where you can create multiple connection pools where all would share a single global pool size limit but also each one would have its own "local" pool size limit. Example: global size: 30 Additionally Postgrest would keep two sets of pools:
The whole thing is designed to spread read queries among read-only replicas of a single master. The set-up is designed to support https://cloudnative-pg.io where separate k8s services are provided for master and replicas. |
Everything that connects to multiple databases, will need multiple sets of connection credentials etc. - so a hugely different interface for configuration. I think the best way forward would be to improve the separation between what is part of the We can then re-use the library for other executables:
|
If we had this I think then an Ubuntu/Debian package would make more sense since it could have a single systemd service. Right now we need systemd services for each db. |
Related discussion on #3101 (comment) for using a psql compatible ini file for multiple databases. |
Problem
libpq
offers a native way to use multiple hosts, yet we don't support it. See:https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-MULTIPLE-HOSTS
PostgreSQL libpq 16 will even support load balancing natively on these hosts: https://mydbops.wordpress.com/2023/05/07/postgresql-16-brings-load-balancing-support-in-libpq-psql/
Solution
AFAICT, we already support using the
PGHOST
env var. But we don't support multiple values, we would need to create multiple instances of our connection pool.We could consider using the HTTP
Host
header to let the user choose a database.The text was updated successfully, but these errors were encountered: