Performance: Prisma Client usage
MEDIUM IMPACT
This affects server response time and database query efficiency, impacting how fast data is fetched and sent to the frontend.
const users = await prisma.user.findMany({ include: { posts: true } });const users = await prisma.user.findMany(); for (const user of users) { user.posts = await prisma.post.findMany({ where: { authorId: user.id } }); }
| Pattern | Database Queries | Server Response Time | Network Payload | Verdict |
|---|---|---|---|---|
| N+1 Query Pattern | Multiple queries (N+1) | High due to many DB calls | Larger due to repeated data | [X] Bad |
| Single Query with Include | Single optimized query | Low and consistent | Smaller and efficient | [OK] Good |