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 connection pooling uses a dedicated pooled TCP connection string.
Connection pooling with TCP
To use connection pooling over TCP, use the pooled connection string for your Prisma Postgres database:
# Direct connection (no pooling)
DATABASE_URL="postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require"
# Pooled connection
DATABASE_URL="postgres://USER:PASSWORD@pooled.db.prisma.io:5432/?sslmode=require"How to enable connection pooling
- Open your Prisma Postgres database in Prisma Console.
- Copy the pooled TCP connection string.
- Set it as
DATABASE_URLin your application environment. - Redeploy your application so new instances use the pooled connection.
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:
| Free | Starter | Pro | Business | |
|---|---|---|---|---|
| Direct connections | 10 | 10 | 50 | 100 |
| Pooled connections | 10 | 100 | 500 | 1000 |
Idle pooled 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
| Direct | Pooled | |
|---|---|---|
| How it works | Your app connects straight to the database | Your app connects through a managed connection pooler |
| Best for | Local development, background jobs, low-concurrency workloads | Serverless functions, APIs, high-traffic or bursty workloads |
| Typical usage | Long-lived connections | Short-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.