say I want to fetch all the content belonging to 1...
# orm-help
j
say I want to fetch all the content belonging to 1 user, and nest the user in the result set:
const blogs = await prisma.blogs.findMany({where: { userId }, include: {user:true}});
is prisma / sql smart enough so that it won’t do a join on every single one of the results, since it will always be the same userId/user? if not, is it recommended to just fetch that user once in a separate query?
1
n
Hi Joey 👋 You can check the queries which are being invoked by prisma client by enabling logging, this would show the select queries which will be invoked by prisma, there would be no join query. I would recommend include the user with blog instead of doing a separate query.
🔥 1