This guides teaches you how to add connection pooling to a PostgreSQL database hosted on Neon using Prisma Accelerate.
Prisma Accelerate is a connection pooler that keeps your database within its connection limits during traffic spikes and high load. Check out this video demonstrating how it performs in a load test or learn why connection pooling is important.
Install the Prisma Client extension for Accelerate:
bun add @prisma/extension-accelerate
Bash
pnpm prisma generate
Bash
yarn prisma generate
Bash
npx prisma generate
[!NOTE]
In Prisma v7, the --no-engine flag is no longer required when using Prisma Accelerate. Previously, you would run prisma generate --no-engine, but now the standard prisma generate command works for all use cases.
This is needed to access Prisma Accelerate's connection pool.
In the Choose your starting product section, find the Accelerate card and click Get started
In the field for your Database connection string, paste your Neon connection string
Select the Region that's closest to your database
Click Create project
On the next screen, click Enable Accelerate
Once you went through these steps, you'll be redirected to another page where you need to the click the Generate API key button.
You'll then be shown a new connection URL which enables you to connect to Prisma Accelerate's connection pool. This needs to be set as the new DATABASE_URL in your .env file: