Prisma 1 Forum

Do Prisma resolve N+1 problem?

Do Prisma resolve N+1 problem?
E.g. I take 100 users with their friends, for example. Will it optimize queries (make 2 and combine data or use joins)? Or it will run 101 query?


Prisma will load data efficiently in those cases (2 queries). Prisma has a data loader that will first fetch the users with one query and will then make a deferred pass to fetch all friends.



thank you! great news)

Thanks for bringing up this question, @Terion :slightly_smiling_face:

I agree with what you said on Slack - this should be part of our documentation. Iā€™d be happy to review a PR that adds a respective section.

Thanks :raised_hands: