How prisma handle with n+1 problem using relation strategy query instead of join?
My question is prisma handle the queries to handle the n+1 problem?
1 Reply
Hey @Rev 👋
Have you seen this section of our docs?
https://www.prisma.io/docs/orm/prisma-client/queries/query-optimization-performance#solving-the-n1-problem
When you set relationLoadStrategy to
query
Prisma Client sends multiple separate queries to the database, it then joins the data on the application level, rather than in the database.
When the relationLoadStrategy is set to join
, Prisma Client invokes a single query which is executed against the database. This approach uses database joins instead of separate queries for related data.Query optimization | Prisma Documentation
How Prisma optimizes queries under the hood