prisma-connection-pool-exhaustion

Configure Prisma connection pooling for serverless PostgreSQL or MySQL deployments.

Updated Oct 27, 2025
One-click install
npx skills add https://github.com/SomtoUgeh/dotfiles --skill prisma-connection-pool-exhaustion-somtougeh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-connection-pool-exhaustion
Source: https://github.com/SomtoUgeh/dotfiles/tree/main/claude/skills/claudeception/examples/prisma-connection-pool-exhaustion
Command: npx skills add https://github.com/SomtoUgeh/dotfiles --skill prisma-connection-pool-exhaustion-somtougeh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prisma-based serverless applications often instantiate a new PrismaClient per cold start, which opens multiple database connections and can exhaust the database's connection limit under high concurrency. This Skill guides you to implement effective connection pooling to stabilize connections and prevent timeouts.

Core Features & Use Cases

  • Connection pooling integration: Introduce a pooler (PgBouncer) or Prisma Accelerate between serverless functions and the database.
  • Prisma configuration: Update datasource url and per-instance connection limits to reduce total active connections.
  • Singleton pattern: Implement a reusable PrismaClient instance to avoid creating new clients on every invocation.
  • Use Case: Works well for high-traffic serverless APIs on PostgreSQL or MySQL where cold starts trigger many connections.

Quick Start

Start by adding a pooling layer between your serverless functions and your database, then update your Prisma setup and deploy. Verify under load that the number of active connections stays within limits.

Frequently Asked Questions about prisma-connection-pool-exhaustion

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

FAQPage Schema
Why does Prisma connection pool exhaustion happen in serverless environments?

Prevent Prisma connection pool exhaustion in serverless environments by introducing a connection pooler like PgBouncer or Prisma Accelerate between your functions and database, then updating your Prisma schema datasource URL to route through it.

How do I configure Prisma to use a connection pooler on Vercel or AWS Lambda?

Configure Prisma connection pooling on serverless platforms by updating the datasource URL to point to a pooler like PgBouncer or Prisma Accelerate, setting per-instance connection limits, and implementing a singleton PrismaClient to limit total active connections.

Does this Prisma connection pooling approach work with both PostgreSQL and MySQL?

Yes, this Prisma connection pooling approach works with both PostgreSQL and MySQL serverless deployments, stabilizing active connections and preventing timeouts during high concurrency and cold-start scenarios on platforms like Vercel and AWS Lambda.

Do I need PgBouncer or Prisma Accelerate to fix Prisma connection limits in serverless apps?

Limit Prisma database connections per serverless instance by implementing a reusable singleton PrismaClient pattern and setting per-instance connection limits in your Prisma schema to prevent cold starts from spawning uncontrolled new connections.