P
Prisma•4mo ago
Mattèo

Slowness issue when using Supavisor connection pooling with Prisma

Hey Prisma community, I've set up Supabase Supavisor connection pooling on my Supabase project but it turns out that the request is abnormally slow with Prisma when I use supavisor. I compared the time it took to make a request with console.time and the result was clear. The tests are done locally with a remote postgres database hosted on Supabase with Supavisor enabled. I have the latest version of Prisma installed Here is my connection string in my .env
# Slow setup for Supabase with Supavisor
DATABASE_URL="postgres://postgres.project_id:[email protected]:6543/postgres?pgbouncer=true&connection_limit=1"
DIRECT_DATABASE_URL="postgres://postgres.project_id:[email protected]:5432/postgres"

# Fast setup for Supabase without using Supavisor
DATABASE_URL="postgres://postgres.project_id:[email protected]:5432/postgres"
DIRECT_DATABASE_URL="postgres://postgres.project_id:[email protected]:5432/postgres"
# Slow setup for Supabase with Supavisor
DATABASE_URL="postgres://postgres.project_id:[email protected]:6543/postgres?pgbouncer=true&connection_limit=1"
DIRECT_DATABASE_URL="postgres://postgres.project_id:[email protected]:5432/postgres"

# Fast setup for Supabase without using Supavisor
DATABASE_URL="postgres://postgres.project_id:[email protected]:5432/postgres"
DIRECT_DATABASE_URL="postgres://postgres.project_id:[email protected]:5432/postgres"
// schema.prisma

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_DATABASE_URL")
}
// schema.prisma

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_DATABASE_URL")
}
console.time("totalStudents");
const totalStudents = await db.user.count({
where: {
role: "STUDENT",
},
});
console.timeEnd("totalStudents");
console.time("totalStudents");
const totalStudents = await db.user.count({
where: {
role: "STUDENT",
},
});
console.timeEnd("totalStudents");
With Supavisor : 291.246ms Without Supavisor (same connection string in DATABASE_URLand DIRECT_DATABASE_URL) : 52.009ms Does someone can help me ? Have a nice day😉
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server