prisma-connection-pool-exhaustion

Mitigate Prisma connection pool exhaustion in serverless environments with pooling and singleton client management.

35|222|Updated Jan 18, 2026
One-click install
npx skills add https://github.com/AlexMikhalev/claude-code-continuous-learning-skill --skill prisma-connection-pool-exhaustion-alexmikhalev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-connection-pool-exhaustion
Source: https://github.com/AlexMikhalev/claude-code-continuous-learning-skill/tree/main/examples/prisma-connection-pool-exhaustion
Command: npx skills add https://github.com/AlexMikhalev/claude-code-continuous-learning-skill --skill prisma-connection-pool-exhaustion-alexmikhalev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Serverless functions often instantiate a new Prisma client on cold starts, opening multiple database connections and exhausting the database connection pool.

Core Features & Use Cases

  • Connection pooling guidance: implement a pooler like PgBouncer or Prisma Accelerate to manage connections between serverless functions and the database.
  • Prisma client optimization: apply a singleton PrismaClient to reuse a single client across invocations, with development-time safeguards.
  • Environment tuning: adjust per-instance connection limits, timeouts, and pool settings for PostgreSQL/MySQL backends.
  • Use Case: deployed on Vercel, AWS Lambda, or Netlify with managed PostgreSQL or MySQL where concurrent requests risk pool exhaustion.

Quick Start

Enable a pooling service, configure a singleton Prisma client, and set connection limits to stabilize connections under load.

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?

Prisma connection pool exhaustion occurs because serverless functions instantiate a new Prisma client on cold starts, opening multiple database connections that quickly exhaust the pool during traffic spikes. Implementing a pooler and a singleton client mitigates this.

How do I fix Prisma connection pool exhaustion on Vercel and AWS Lambda?

To fix Prisma connection pool exhaustion on Vercel and AWS Lambda, enable a pooling service like PgBouncer, configure a singleton PrismaClient to reuse connections across invocations, and tune connection limits and timeouts for your PostgreSQL or MySQL backend.

Does this Prisma serverless connection pooling approach work with MySQL backends?

Yes, this Prisma serverless connection pooling approach works with MySQL backends. It applies environment tuning for per-instance connection limits, timeouts, and pool settings to stabilize connections for both PostgreSQL and MySQL during concurrent serverless requests.

What is the best way to manage Prisma client lifecycle in serverless functions?

The best way to manage Prisma client lifecycle in serverless functions is enforcing a singleton PrismaClient with development-time safeguards. This reuses a single client across invocations, preventing cold starts from opening excessive database connections.

Do I need PgBouncer or Prisma Accelerate to prevent Prisma pool exhaustion?

You need a pooler like PgBouncer or Prisma Accelerate to prevent Prisma pool exhaustion by managing connections between serverless functions and the database. This intercepts cold start connection surges and stabilizes the backend under load.