Connection pooling

Learn how to use connection pooling with your Prisma Postgres database.

Connection pooling keeps a set of database connections open and reuses them across requests, rather than opening a new connection for every query. This reduces latency and lets your database handle more concurrent requests. This is especially important in serverless and high-traffic environments where connection limits can be exhausted quickly.

Prisma Postgres supports connection pooling through TCP connections. You can also use Prisma Accelerate for connection pooling with additional features like caching.

Connection pooling with TCP

TCP connection pooling is currently in Early Access.

To use a pooled connection, append &pool=true to your Prisma Postgres TCP connection string:

# Direct connection (no pooling)
DATABASE_URL="postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require"

# Pooled connection
DATABASE_URL="postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require&pool=true"

You can also enable connection pooling when generating your connection string in the Prisma Console by toggling on the pooling option.

This works with any PostgreSQL client, ORM, or database tool you already use.

Connection limits

The number of available connections depends on your plan and whether you use a pooled or direct connection:

FreeStarterProBusiness
Direct connections101050100
Pooled connections101005001000

Idle connections are closed after 60 minutes. You can compare plans on the Prisma pricing page.

With TCP connections, there are no limits on query duration, transaction duration, or response size.

When to use pooled vs. direct connections

DirectPooled
How it worksYour app connects straight to the databaseYour app connects through a managed connection pooler
Best forLocal development, background jobs, low-concurrency workloadsServerless functions, APIs, high-traffic or bursty workloads
Typical usageLong-lived connectionsShort-lived or burst connections

For most production applications, pooled connections are recommended. Use direct connections when you need a persistent connection or are working in a low-concurrency environment like local development.

On this page