Error: too many connections for database "postgres"
When getting an error where your connections are overwhelmed Error: too many connections for database "postgres"
Why this occurs
This issue occurs when datconnlimit gets modified. The default value for datconnlimit is -1.
https://www.postgresql.org/docs/current/catalog-pg-database.html
To check and resolve
-
Check the value for
datconnlimitusing the query belowselect datconnlimit from pg_database where datname='postgres';- If the value you see is 0 or any other value other than -1, proceed with the next step.
-
Update
datconnlimitto DEFAULTALTER DATABASE postgres CONNECTION LIMIT DEFAULT;
Related topics
- Connection management
- Connection pooling and limits
- How to change max database connections
- Remaining connection slots are reserved for non-replication superuser connections
- Monitor Supavisor Postgres connections