configuring-connection-pools

Configure Prisma Client connection pools for PostgreSQL deployments.

Updated Nov 21, 2025
One-click install
npx skills add https://github.com/djankies/claude-configs --skill configuring-connection-pools
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: configuring-connection-pools
Source: https://github.com/djankies/claude-configs/tree/main/prisma-6/skills/configuring-connection-pools
Command: npx skills add https://github.com/djankies/claude-configs --skill configuring-connection-pools

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Serverless and high-concurrency environments can exhaust database connections if pool sizing is not configured properly. This Skill covers sizing strategies and best practices for Prisma Client pools.

Core Features & Use Cases

  • Standard pool sizing: connection_limit ≈ (CPU cores × 2) + 1.
  • Serverless per-instance pattern: limit = 1 to prevent cross-instance exhaustion.
  • PgBouncer guidance for high concurrency and transaction-mode pooling.
  • Production readiness: pool_timeout, connect_timeout, and monitoring.

Quick Start

Update DATABASE_URL with an appropriate connection_limit and pool_timeout; consider PgBouncer for scaling beyond per-instance limits.

Frequently Asked Questions about configuring-connection-pools

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent database connection exhaustion in serverless environments?

Connection exhaustion in serverless occurs when multiple Lambda instances open independent connections, overwhelming the database. Configure Prisma's connection_limit to 1 per instance and use PgBouncer for pooling across instances to share connections and prevent exhaustion.

What connection pool settings should I use for Prisma in production?

Tune Prisma's connection_limit to approximately (CPU cores × 2) + 1 for traditional servers. Set pool_timeout and connect_timeout in your DATABASE_URL to handle connection queuing and timeout scenarios, adjusting based on your workload and infrastructure.

When should I use PgBouncer with Prisma?

Use PgBouncer when Prisma alone cannot handle your concurrency demands or when deploying across multiple serverless instances. PgBouncer provides transaction-mode pooling and scales connection reuse beyond per-instance limits, improving throughput in high-concurrency scenarios.

Can I configure connection pools differently for serverless versus traditional servers?

Yes. Serverless deployments require connection_limit = 1 per instance to prevent cross-instance exhaustion, while traditional servers benefit from (CPU cores × 2) + 1. Environment-specific DATABASE_URL patterns and deployment checklists ensure each context applies the right strategy.

What happens if pool_timeout or connect_timeout values are too low?

Low timeout values cause connection requests to fail prematurely under load, reducing throughput and generating errors. Balance timeouts with your application's latency tolerance and database response times to queue requests without unnecessary drops.