Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Raising a database’s connection limit can allow more clients to connect, but it does not make queries run faster or add database capacity. A higher ceiling may instead increase resource use and worsen pressure when the real constraint is CPU, memory, storage I/O, locks, slow queries, or excessive connection churn. The right response is to find what is saturated, then decide whether to reuse connections, queue clients, or—if the workload and available resources support it—increase the limit.

Why not just increase the connection limit?

A connection ceiling is a limit on concurrent connections, not a throughput control. PostgreSQL’s documentation describes max_connections as the maximum number of concurrent connections to the server. It is typically 100 in the PostgreSQL 18 documentation, though it can be lower if operating-system kernel settings do not support that value. That is a documented default, not a recommended ceiling for every workload or a rule for other database products. PostgreSQL also allocates some resources, including shared memory, based directly on max_connections; changing it requires a server restart. PostgreSQL 18: Connections and Authentication

More connections can help only when the database can productively handle more concurrent work and the current limit is actually preventing it. If existing work is blocked on locks, waiting on slow storage, or consuming available CPU, admitting more sessions does not remove those bottlenecks. It can make contention worse.

What does a database connection cost?

PostgreSQL uses a process per user connection

PostgreSQL’s documented client/server architecture uses a process for each user connection: a supervisor process spawns a backend when a connection is requested. This is specific to PostgreSQL and should not be assumed to describe every database engine. A large population of idle PostgreSQL sessions still has resource implications, even when those sessions are not actively running queries. PostgreSQL 16: How Connections Are Established

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall

Managed-service limits vary

Amazon RDS connection maxima depend on the database engine and DB instance memory. AWS warns that setting a connection parameter too high can lead to a low-memory condition, because connections consume memory. An RDS value therefore is not a universal limit or recommendation for self-managed databases, other engines, or differently sized instances. AWS: Quotas and constraints for Amazon RDS

How to diagnose “too many connections”

  1. Verify the engine, configured limit, and error. Confirm that the application is actually hitting the connection ceiling rather than reporting a different failure. On PostgreSQL, AWS points to pg_stat_database as one source for troubleshooting connection issues. AWS: Quotas and constraints for Amazon RDS
  2. Count connections across the whole application fleet. Measure connection creation rate, simultaneous clients, active work, idle sessions, and pool sizes across every replica, worker, and function instance. A per-process pool setting multiplies when many processes run at once.
  3. Separate churn, idle sessions, and real concurrent work. Frequent open-and-close cycles point toward reuse; many idle sessions point toward pool sizing or lifecycle management; many simultaneously active queries may reflect genuine demand—or queries spending time blocked on another resource.
  4. Choose how excess clients should behave. Decide whether they wait for an available backend, time out, or fail fast. A queue can smooth bursts, but it also adds waiting; a timeout or fast failure makes overload visible rather than allowing unbounded waiting.
  5. Raise the server limit only with evidence and headroom. Check engine-specific memory and operational constraints, then monitor resource use. A higher maximum is not a fix by itself if the workload is limited elsewhere.

How pooling and proxies change the connection problem

A pool keeps a bounded number of reusable database-side connections and serves more application clients through them. This can reduce connection open-and-close overhead and the risk of too-many-connections errors, but it does not make a slow, expensive, or blocked query cheaper. When the backend pool is occupied, clients must wait, time out, or encounter the configured limit.

Application-level pool

An application pool reuses connections within application processes. Size it with the fleet-wide total in mind: several replicas, each configured with a seemingly modest pool, can collectively exceed the database’s useful connection budget. Also consider how the pool is created and closed, and whether traffic bursts can overwhelm the available backends.

PgBouncer

PgBouncer is a self-managed pooling option for PostgreSQL. Its configuration provides separate controls for client connections and server (database-side) connections, so operators can cap backend concurrency while allowing more clients to connect and wait. Pool mode and session-state behavior affect compatibility; check the configuration and validate it against the actual workload before relying on multiplexing. PgBouncer: Configuration

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A 2021 AWS Database Blog test configuration used PgBouncer with up to 5,000 client connections and at most 200 connections to its test RDS PostgreSQL instance. Those figures describe that configuration, not a general performance result, capacity recommendation, or guarantee. AWS Database Blog: Performance impact of idle PostgreSQL connections

Amazon RDS Proxy

For supported RDS and Aurora workloads, RDS Proxy offers managed pooling and multiplexing. AWS identifies frequent connection open-and-close cycles and long-lived connections as use cases. Its documentation also describes serverless and event-driven applications, where many short-lived client requests can otherwise create connection churn. Fit depends on engine and deployment compatibility and on how the application uses sessions; a managed proxy is an option, not a universal best choice. AWS: Common usage scenarios for Amazon RDS Proxy AWS: RDS Proxy concepts and terminology

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Which approach fits?

Approach What it changes What to assess
Application-level pool Reuses connections within application processes. Total pool sizes across all replicas, lifecycle management, burstiness, and whether the fleet total can exceed the database budget.
PgBouncer Can cap PostgreSQL server connections separately from client connections. Pool mode and session-state compatibility, operations and failure handling, client queues, and supported features for the selected version. See the configuration reference.
Amazon RDS Proxy Managed pooling and multiplexing for supported RDS and Aurora workloads. Engine and deployment compatibility, AWS integration, session behavior, cost, latency, and operational trade-offs. See AWS’s concepts and terminology.
Raise the database limit Allows more concurrent server connections. Whether connections are the actual constraint, and whether memory, CPU, and other resources have headroom. PostgreSQL documents resource-allocation effects; AWS cautions about low-memory conditions on RDS. PostgreSQL documentation AWS RDS documentation

How many database connections do you need?

There is no universal safe number established by these sources. The appropriate ceiling and pool size depend on the database engine, deployment, query profile, session requirements, workload bursts, and total number of application processes. Set a bounded budget from observed workload and resource headroom, and make the behavior at that boundary explicit: queue, time out, or reject excess clients.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.