"too many connections for database" in Postgres.

491 views
Skip to first unread message

Jack Pordi

unread,
Jul 16, 2021, 9:25:27 AM7/16/21
to Google Cloud SQL discuss
Hey all,

I've been having an issue where the postgres database in Cloud SQL won't allow connections from anything outside the `psql` command line client - there's always a "too many connections for database 'postgres'" error. I've tried multiple things - increasing machine CPU/memory, restarting, even deleting the database instance and setting up a new one (which solved the problem for a few hours, but after a while the problem came back...).

Querying `pg_stat_activity` tells me there's only 9 connections (see attached image), and only 1 of which is from us and not Google Cloud. Screenshot from 2021-07-16 09-58-45.png

The database instance is Postgres 13, db-g1-small with 1.7GB memory, 10GB HDD storage. Public IP is enabled and our IP addresses are definitely whitelisted. The zone is a single zone eu-west2 (London).

Another coworker said he can't even connect with the `psql` cli either, and DBeaver, PGAdmin, or our backend (in node using typeorm/pg modules) are all getting the same "too many connections for database" error.

babdelrahman

unread,
Jul 19, 2021, 9:45:26 AM7/19/21
to Google Cloud SQL discuss
Hello, 

Can you provide us with the full exact error message.

Thank you.

Reply all
Reply to author
Forward
0 new messages