P
Prisma2mo ago
santi

Which is more efficient: Promise.all([findUnique() * 3]) or prisma.$transaction([findUnique() * 3])?

With prisma, is it more efficient to do
await Promise.all([
prisma.product.findMany()
prisma.order.findMany()
prisma.catalog.findFirst()
])
await Promise.all([
prisma.product.findMany()
prisma.order.findMany()
prisma.catalog.findFirst()
])
OR
await prisma.$transaction([
prisma.product.findMany()
prisma.order.findMany()
prisma.catalog.findFirst()
])
await prisma.$transaction([
prisma.product.findMany()
prisma.order.findMany()
prisma.catalog.findFirst()
])
Maybe transaction is slower because of transactional integrity? Or is there another command / alternative to $transaction that allows me to make just one trip to the database, rather than many? Ideally this is about optimizing efficiency/time/being better than Promise.all, and not about transactional integrity
0 Replies
No replies yetBe the first to reply to this messageJoin