Description
Context
We have a multi-tenant SaaS setup where each tenant has a database in a managed database cluster (Scaleway/DigitalOcean/...). Currently we are using a single cluster. The goal for us for using pgcat is that we can limit the amount of connections to our database cluster as the cluster has a limited amount of connections available.
Problem
As we have one cluster we essentially only need one pgcat pool, the only issue I'm bouncing against is that it is impossible for us to allow multiple different databases inside a single pool. And if I were to create separate pools for each tenant, then the implementation with pgcat has no benefit as we can't limit the connections as a while towards the database cluster. A simple example:
- Max database cluster connections: 100
- Tenant pools: 200
- Pgcat connections to our cluster: 200
Potential solution
It would be awesome if we could allow a regex pattern for which databases should connect to a certain pool, in that way we could say that tenant-1
until tenant-50
should connect to pool 1 and tenant-51
until tenant-100
should connect to pool 2.
[general]
# ...
[pools]
[pools.postgres]
# ...
[pools.postgres.users.0]
# ...
[pools.postgres.shards.0]
servers = [["...", 5432, "primary"]]
database = "^tenant-(?:[1-9]|[1-4][0-9]|50)$"
Or is all this unneeded and am I missing something?