I just want to share my findings. It seems that prisma has been under flak by some people in the community because of its performance. I think that Prisma 5 has fixed that problem so that it is acceptable on most use cases.
I tried using kysely with postgres.js as the dialect, and also directly using postgres.js to try and get a benchmark.
Task: Get a user id
Prisma Code:
const result = await prisma.user.findUnique({
select: { id: true },
where: { id }
})
Postgres.js (Raw SQL):
const result2 = await sql`
SELECT id FROM "user" u WHERE u.id = ${id}
`
Test Setup: PostgreSQL DB server hosted at a 4vcpu digitalocean k8s. Request made from Laptop so latency is a factor
Results after ~500x Test
prisma results 496x 95.96370967741936 ms
postgres results 496x 92.21774193548387 ms
Conclusion (For Now): Prisma is not that slow for simple tasks. I might try to do another benchmark for more complex task later on
Top comments (0)