Rejecting

“Too many connections”: database connection limits explained

Databases accept a limited number of client connections — PostgreSQL defaults to 100, MySQL to 151. When every connection is busy, new clients are refused with an error rather than queued.

What causes it

Connections pile up when queries arrive faster than the database finishes them: each waiting query keeps its connection open. The trigger is often outside the database — a cache restart, a traffic spike, or serverless functions that each open their own connection. Raising max_connections rarely helps: each connection costs memory, and the CPU can only run a few queries at once anyway.

How to recognise it

The math

Connections in use ≈ query rate × query time (Little’s law)

Error messages you will see

ErrorSeen in
FATAL: sorry, too many clients alreadyPostgreSQL, CockroachDB, Amazon RDS (PostgreSQL), Amazon Aurora (PostgreSQL), Cloud SQL (PostgreSQL), AlloyDB for PostgreSQL (PostgreSQL) and 5 more
ERROR 1040 (HY000): Too many connectionsMySQL, MariaDB, Vitess, Amazon RDS (MySQL), Amazon RDS (MariaDB), Amazon Aurora (MySQL) and 3 more
Error 10928: resource limit for the database has been reachedMicrosoft SQL Server, Amazon RDS (SQL Server), Cloud SQL (SQL Server), Azure SQL Database (SQL Server)

How to fix it

Reproduce it in the simulator

These templates trigger this failure on purpose:

Open the simulator

Learn more

Part of the guide Load balancing and capacity planning.

Related failure modes