EasyCloudify
Solutions
  • Cloud PlatformImprove team productivity and integrate popular workflow applications.
  • Cloud Servers (VPS)NVMe SSD servers deployed in under 60 seconds.
  • Object StorageS3-compatible storage with built-in global CDN.
  • Managed DatabasesManaged PostgreSQL, MySQL, MongoDB, Valkey, Kafka & OpenSearch.
  • Managed WordPressManaged WordPress hosting, so you can focus on your business.
  • MarketplaceFind an app that suits you, then spin it up in 60 seconds or less.
  • Mail HostingPrivacy First Email Hosting for your business.
  • SEO & AI Visibility AuditAudit your site for SEO and AI answer engine visibility.
  • SecurityRock-solid application security for your peace of mind.
  • Register DomainsRegister your domain with us and get started.
Company
  • About
  • Legal
Resources
  • Blog
  • Guides
  • Status
Get Started
  • Contact Sales
  • Pricing
  • Dashboard
EasyCloudifyEasyCloudify
PricingContact
Log inStart deploying
EasyCloudify logoEasyCloudify

Fully managed cloud infrastructure — deploy in minutes, not days.

Newsletter

The latest news, articles, and resources — delivered weekly.

Product

  • Cloud Platform
  • Marketplace
  • Managed WordPress
  • Mail Hosting
  • Security

Support

  • Open a Ticket
  • Documentation
  • Contact Sales
  • System Status

Company

  • About
  • Global Infrastructure
  • Blog
  • Pricing

Legal

  • Terms of Service
  • Privacy Policy
  • Acceptable Use
  • All Legal Docs

  • Cloud Platform
  • Marketplace
  • Managed WordPress
  • Mail Hosting
  • Security

  • Open a Ticket
  • Documentation
  • Contact Sales
  • System Status

8 The Green, Suite A, Dover DE 19901, USA
+1 (302) 534-3122

© 2026 EasyCloudify LLC. All rights reserved.

Rated on Trustpilot
Terms of ServicePrivacy PolicyAcceptable Use
EasyCloudifyDocs
⌘K
Managed Databases — Overview, Engines & PlansCreate a Database Cluster — Step-by-StepConnect to Your Managed Database — URIs, SSL & DriversDatabase Users & Logical DatabasesConnection Pooling — PgBouncer for PostgreSQL & MySQLDatabase Firewall & Trusted SourcesDatabase Monitoring & Performance InsightsDatabase Backups & RestoreDatabase Read Replicas — Scale Reads & Isolate WorkloadsDatabase Log Forwarding — Datadog, OpenSearch, Papertrail, rsyslogDatabase Events — Cluster Activity TimelineDatabase Maintenance & Scaling — Window, Resize, Migrate, Destroy
HomeDocsManaged DatabasesConnection Pooling — PgBouncer for PostgreSQL & MySQL
5 min read·Updated 2026-05-19

Connection Pooling — PgBouncer for PostgreSQL & MySQL

TL;DR — A managed connection pool lets thousands of application connections share a small fixed number of real database connections. Open the Pools tab on a PostgreSQL or MySQL cluster, click Create Pool, pick a mode and size, and use the pool's URI in your app.

Connection pooling is supported on:

  • ✅ PostgreSQL (via PgBouncer)
  • ✅ MySQL (via the equivalent pooler)
  • ❌ MongoDB, Valkey, Kafka, OpenSearch — they pool natively in the client driver

Why Use a Pool

Each database connection costs memory and a backend process. A Starter cluster supports a low double-digit number of concurrent connections; even an HA cluster maxes out in the low hundreds. If your application opens one connection per request and you run many app servers, you'll hit too many connections errors quickly.

A pool multiplexes:

  • App servers → connect to the pool (a lightweight TCP service) with no per-connection cost
  • Pool → maintains a small fixed set of real connections to the database, handing them out as needed
  • One pool can handle up to 5,000 concurrent client connections with a backend of just 10–50 real connections

Result: fewer database resources used, more app servers supported, no too many connections errors.

Pool Modes

ModeWhen Connection Is Returned to the PoolUse CaseCaveats
TransactionAfter every COMMIT / ROLLBACKMost web apps (recommended default)Session-level features unavailable: prepared statements, SET, advisory locks, LISTEN/NOTIFY
SessionWhen the client disconnectsApps relying on session state (e.g. SET search_path, prepared statements)Pool fills up faster — needs more backend connections
StatementAfter every statementMaximum concurrency for autocommit-only workloadsNo multi-statement transactions; rarely needed

Start with Transaction. Most ORMs (Prisma, Sequelize, Django, Rails ActiveRecord, SQLAlchemy) work fine in transaction mode as long as you don't rely on session-scoped state.

Create a Pool

  1. Open your cluster → Pools tab
  2. Click Create Pool
  3. Fill in:
FieldDescription
Pool nameFriendly identifier (e.g. myapp-transaction)
Modetransaction, session, or statement (default: transaction)
SizeNumber of real backend connections the pool will hold open (typically 10–25 for Starter, 25–100 for HA)
UserThe database user the pool will authenticate to the database as
DatabaseThe logical database the pool serves
  1. Click Save

The pool appears in the list with its own URI you can copy.

Use the Pool in Your App

Replace your direct database URI with the pool URI (visible on the pool row's copy button). It looks the same as a normal connection URI but ends with the pool's port.

# Before — direct connection
postgresql://doadmin:PWD@host:25060/defaultdb?sslmode=require

# After — through the pool
postgresql://doadmin:PWD@host:25061/myapp-transaction?sslmode=require

Update your application's DATABASE_URL environment variable and redeploy. Your app code does not change.

Sizing the Pool

A common rule of thumb: pool size = (cluster's max connections) − (a small reserve for migrations and ad-hoc access). With a Starter cluster (≈ 25 max connections), a pool size of 15–20 is sensible. With an HA cluster (≈ 150 max), 100 is typical.

If your app opens its own pool too (e.g. Prisma's default of 10 per app server), multiply by app server count:

  • 4 app servers × 10 client-side pool = 40 simultaneous server-side connections expected
  • Pool size should be ≥ 40 — but the great trick of PgBouncer is that client-side pools can be much larger than server-side pools (transaction mode), so 4 app servers × 50 client-side pool, with server-side pool 15, works perfectly

Transaction Mode Caveats

If you use Transaction mode (the default), avoid:

  • Prepared statements that span transactions. Most modern drivers handle this automatically by re-preparing on each connection (Prisma, pg, mysql2 all do).
  • SET statements outside a transaction. Wrap them in BEGIN ... COMMIT or use database-level configuration.
  • LISTEN / NOTIFY in PostgreSQL — needs Session mode.
  • Advisory locks across statements — needs Session mode.
  • Temporary tables that need to outlive a single transaction — needs Session mode.

If any of these break, create a second pool in Session mode for the workload that needs it, and use the transaction pool for everything else.

Delete a Pool

Click the trash icon on the pool row. Update your application config first — any connection currently using the pool will fail when it's removed.

Monitoring Pools

The pool itself is transparent — there's no separate metrics tab for pools. To monitor:

  • Watch the Active Connections chart on the Insights tab — it should now hover near the pool size, not the per-app-server count
  • Look for pgbouncer lines in the cluster's logs if you've enabled log forwarding

Troubleshooting

"prepared statement does not exist"

You're hitting Transaction mode's caveat. Either switch your ORM to disable cross-transaction prepared statements, or create a Session-mode pool.

"no such database" when connecting to the pool

The pool's database parameter must match the logical database you created. The pool URI uses the pool name as the database segment of the URI — but internally it maps to the database you configured.

Pool fills up under load (server connections busy)

Increase the pool size, or convert the pool from Session mode to Transaction mode. Inspect the cluster's Active Connections chart to see whether you're hitting cluster limits too.

App connections still spiking on the cluster

Make sure the app is actually using the pool URI, not the direct URI. Check DATABASE_URL on the running app server.


Related Guides

  • Connect to Your Database
  • Database Users & Databases
  • Monitoring & Performance Insights
  • Maintenance & Scaling
PreviousDatabase Users & Logical DatabasesNextDatabase Firewall & Trusted Sources
On this page
  • Why Use a Pool
  • Pool Modes
  • Create a Pool
  • Use the Pool in Your App
  • Sizing the Pool
  • Transaction Mode Caveats
  • Delete a Pool
  • Monitoring Pools
  • Troubleshooting
  • "prepared statement does not exist"
  • "no such database" when connecting to the pool
  • Pool fills up under load (server connections busy)
  • App connections still spiking on the cluster
  • Related Guides

Was this helpful?

AI Tools