Managed PostgreSQL: Handling Multi-Tenancy

My frontend and backend are hosted as serverless functions on Vercel. I am using a multi-tenancy approach, where every client get’s it’s own database. This means however, that I run out of connections pretty quickly, because AFAIK you need a new connection for each database. I am thinking to switch to digital ocean, because of the managed connection pooling, which should decrease the amount of connections needed for each database and I guess I could setup the connection pool via the API for each new database. However there is still the hard limit of connections.

My question is if my assumptions are right, or how I should go about the database topic with my use case and if there is a possibility to increase the max_connections of my psql db

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @devFish,

PgBouncer pool connections are currently limited to 20 per database. If you require more PgBouncer pool connections than this you will need to contact DO support.

And for Postgres managed database, the connection limit is set depending upon the size of the database cluster.

For example: If you have a 1 GB RAM cluster it will get 25 backend connections and 3 connections will be reserved for maintenance; so the available backend connection that you will get is 22.

For more information on Postgres managed database limitation check the below article :

I hope this helps!

Regards, Rajkishore