I Ditched Prisma for Raw SQL (And My Queries Got 10x Faster)
Prisma is genuinely good software. The schema DSL is clean, the type generation works well, and for a new project it gets you to a working data layer in an hour. I used it for about a year before I...

Source: DEV Community
Prisma is genuinely good software. The schema DSL is clean, the type generation works well, and for a new project it gets you to a working data layer in an hour. I used it for about a year before I started noticing things. The first sign was a query that should have taken 5ms taking 80ms. The second was a N+1 that I'd technically solved with include but was still generating 15 SQL statements. The third was opening prisma.$queryRaw for the third time in a week because the query builder couldn't express what I needed. At that point I stopped fighting the abstraction and started writing SQL directly. What Prisma Actually Does to Your Queries This is a simple query with a filter and pagination: const logs = await prisma.logEntry.findMany({ where: { organizationId: orgId, timestamp: { gte: from, lt: to, }, level: { in: ["error", "fatal"] }, }, orderBy: { timestamp: "desc" }, take: 50, skip: page * 50, }); The SQL Prisma generates: SELECT "public"."log_entries"."id", "public"."log_entries"."