The world's worst pool party: Connection management with Prisma
summary
Explains why Postgres and hosted tiers hit connection limits (Heroku dev ≈20, AWS formula gives ≈198 for t2 small), shows the Prisma Client pool using the CPU2+1 default and an example pool of four, and demonstrates the serverless failure mode: 200 AWS lambda instances × ~5 connections = ~1000 connections overwhelms the DB. Recommends instantiating one Prisma Client, tuning pool timeout or setting pool size to one, and deploying pgBouncer or a queuing + batch-write pattern or switching to Aurora Serverless V2*.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 0:40Overview
- 5:05Connection pool
- 6:35Queue management
- 7:57One Prisma Client
- 9:43Prisma Client Tips
- 12:18Connection Limits
- 14:52Serverless
- 16:32The problem
- 19:13pgbouncer
- 20:35Architecture
- 23:02Questions
related talks
20mElephant by the pool: PostgreSQL connection poolers overview
33mServerless & Databases - your options and best practices
13mA Deep Dive into the DB Connection Pool
14mMaking Postgres serverless
28mNext.js and Prisma: Databases in Serverless Made Easy
24mDatabase Access on the Edge with Cloudflare Workers & Prisma
46mPgBouncer Connection Pooling and Routing
50mPostgreSQL gotchas for app developers
