October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

Connection Pooling vs. Opening a New Database Connection for Every Request

A bounded connection pool is the practical default for persistent request-driven apps, but the right size depends on productive database concurrency, not peak request count.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For most request-driven applications that repeatedly access a database, use a bounded connection pool: requests can reuse established connections instead of creating and closing one for each request. Pooling reduces repeated connection setup and limits how many connections the application can use at once. It also introduces queues and timeouts, so the pool must be sized and monitored against the workload.

What changes between the two approaches?

A database connection is more than a lightweight handle. In PostgreSQL 18, the server supervisor starts a backend process when it detects a connection request, and each client process connects to exactly one backend process. Opening a fresh connection for every request therefore repeats setup and can create a burst of server-side work when requests arrive together.

With an application-side pool, the application keeps a bounded set of connections available. A request borrows one, uses it, then releases it. In a typical pool, closing the borrowed connection returns it to the pool; it does not close the underlying database connection.

Approach How it works Advantages Costs and risks
New connection per request Create a connection, run the request’s database work, then close it. Simple lifecycle; can suit low traffic or short-lived processes that cannot retain a useful pool. Repeats connection setup and may produce many simultaneous connection attempts and PostgreSQL backend processes during bursts. The available documentation does not establish a universal latency penalty or traffic threshold.
Application-side pool Borrow a connection from a bounded set, then release it for reuse. Avoids repeatedly establishing connections and caps the application’s direct database concurrency. Requests wait when all connections are in use. An undersized pool can queue useful work; an oversized one can add unproductive database concurrency.
External pooler, such as PgBouncer Applications connect to the pooler, which manages connections to PostgreSQL and can queue clients for available server connections. Can let many application clients share a smaller server-connection budget and centralize connection limits. Adds configuration and an operational component. Client/server limits, queue behavior, pool mode, and session-dependent features need attention.

Why more connections do not necessarily mean more throughput

Connections permit concurrent database work, but the database has finite CPU, memory, I/O, and other resources. PostgreSQL community guidance describes throughput rising with concurrency until resources saturate; after that, contention can make throughput fall. The useful concurrency level depends on the workload, so there is no generally correct pool size or request-count threshold.

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

A pool is a concurrency control, not a fix for slow queries, lock contention, or an overloaded database. If requests are waiting, determine whether the wait is for a pool connection or for database work to finish; increasing the pool maximum can worsen contention if the database is already saturated.

Choose the pooling layer that fits the application

Use an application-side pool for persistent request-driven services

When a process persists and many requests access the database, a bounded local pool is a sensible default. It allows requests handled by that process to reuse established connections. Choose a pool implementation supported by the application’s runtime and driver; do not assume a driver’s supplied pooling example is production-ready.

For example, pgJDBC documents limitations in its supplied pooling DataSource: connections are not closed until the pool closes, the pool cannot shrink, and error handling may fail to remove a broken connection. Its documentation generally does not recommend that implementation.

Consider an external pooler when many clients share a server budget

If numerous application processes or services would otherwise connect directly to PostgreSQL, an external pooler can manage a smaller set of server connections. PgBouncer distinguishes client-connection limits from server-connection limits; excess clients can wait for a server connection to become available. Azure’s guidance for Azure Database for PostgreSQL Flexible Server is one provider-specific example. Whether to add a pooler depends on the deployment and its connection budget, not on a universal rule.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Verify behavior in short-lived and serverless runtimes

A local pool helps only if the runtime retains it long enough to reuse connections. Short-lived or serverless execution may not do so. Check the current platform guidance and verify whether pooling is provided by the runtime, a managed database service, or an external pooler before choosing an architecture.

Size the pool and monitor the queue

  1. Establish the database’s connection budget. Account for all application processes, services, administrative connections, and any external pooler—not just one process’s pool maximum.
  2. Set a bounded maximum based on productive concurrency. Do not set the limit equal to the highest conceivable request count by default. Use representative workload measurements to find where additional database concurrency stops helping.
  3. Configure acquisition timeouts and queue behavior. Requests should not wait indefinitely for a connection. Choose failure and timeout behavior appropriate to the service, and make overload visible rather than hiding it in an unbounded queue.
  4. Observe both application and database signals. Track active and idle server connections, pool acquisition wait time, timeouts, queue depth, request latency, and database saturation indicators. With PgBouncer, distinguish client connections from server connections.
  5. Test realistic transactions and failure cases. Measure throughput and latency under representative concurrency, and check what happens when a connection breaks or the database becomes unavailable.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check session and prepared-statement compatibility

Pooling modes can change whether a client keeps the same database session across transactions. Applications that depend on session state or prepared statements should verify the selected pool mode and its documented compatibility. For example, PostgREST documents that its transaction-pooling integration requires setting db-prepared-statements to false; its described session-pooling configuration is compatible. This is a product-specific requirement, not a universal rule for every pooler or client.

Decision checklist

  • Persistent application, repeated database access: start with a bounded application-side pool.
  • Many processes or services exceed the direct server-connection budget: evaluate an external pooler and its queue, limits, and operating requirements.
  • Low traffic or short-lived process: opening per request may be acceptable, but consider the setup cost and burst behavior; there is no documented universal traffic cutoff.
  • Session state or prepared statements in use: confirm they work with the chosen pool mode before rollout.
  • Pool waits or poor throughput: inspect queueing and database saturation before raising the connection maximum.

The relevant factors are runtime lifetime, connection-establishment overhead, productive database concurrency, number of application clients, queue and timeout behavior, session compatibility, and the operational visibility available for the chosen pool.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.