Report this

What is the reason for this report?

Manage PostgreSQL Error: remaining connection slots are reserved for non-replication superuser connections. sorry, too many clients already

Posted on July 30, 2021

I explored DigitalOceans Managed Databases particularly PostgreSQL as a means to simplify development and save time although I found that very frequently there would be the following error:

Error: remaining connection slots are reserved for non-replication superuser connections. sorry, too many clients already

I noticed that this error would occur quite frequently regardless of what was invoking the database for example as to whether a tool like DataGrip / PgAdmin were being used or the backend server. At first I thought it was related to the backend server until I started getting the error within DataGrip additionally.

We’re using Strapi and PostgreSQL, with 3 developers working on this simultaneously.

I’ve explored using connection pooling although have had the following error with both database tool and server:

cross database references are not implemented

I’ve now explored creating and hosting my own PostgreSQL database on a DigitalOcean Ubuntu droplet and the error no longer seems to occur.

So whilst I’ve found a solution or workaround, I am interested as to why this error occurs with DigitalOcean Managed PostgreSQL Database.

Thanks for your help :)

Michael



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!

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.

Hello,

Each PostgreSQL cluster allows 25 backend connections per 1 GB of RAM minus 3 connections per node that are reserved for maintenance.

Here is a quick overview of the allowed backend connections based on each plan:

Plan Size Available Backend Connections
1 GB RAM 22
2 GB RAM 47
4 GB RAM 97
8 GB RAM 197
16 GB RAM 397
32 GB RAM 797
64 GB RAM 1,597

Connection pooling is also supported, backed by PgBouncer, to increase the number of available concurrent client connections. However, these PgBouncer pool connections are currently limited to 20 per database.

Hope that this helps. Regards, Bobby

Same thing on my side. Created a pool connection as recommended in current documentation and I’m still facing the same problem.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.