DataLoader and the N+1 problem
Draft post about DataLoader.
Before
// 1 + N queries
for (const p of profiles) await prisma.skill.findMany({ where: { profileId: p.id } })After
// 5 queries for any request
loader.load(id)Draft post about DataLoader.
// 1 + N queries
for (const p of profiles) await prisma.skill.findMany({ where: { profileId: p.id } })// 5 queries for any request
loader.load(id)