You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the Prisma preview feature relationJoins that as the docs say
Uses a database-level LATERAL JOIN (PostgreSQL) or correlated subqueries (MySQL) and fetches all data with a single query to the database.
and I was expecting that when requesting an entity and one of its relation we would be reducing the number of queries dramatically to even just one but that's not being the case.
For example, for the following graphql request:
query keystone($where: SubscriptionContractWhereInput!) {
author(take: 10, skip: 0) {
id
posts {
id
}
}
}
I can see in the console 10 + 1 queries, first getting the Author table, and then querying 10 times the Posts table. I'm also seeing that we include ALL the fields of both tables despite I'm just asking for one field.
If in the same server I use the following Prisma function:
I'm using the Prisma preview feature
relationJoins
that as the docs sayFor example, for the following graphql request:
I can see in the console 10 + 1 queries, first getting the Author table, and then querying 10 times the Posts table. I'm also seeing that we include ALL the fields of both tables despite I'm just asking for one field.
If in the same server I use the following Prisma function:
I can see in the logs just one query that uses the LATERAL JOIN.
The text was updated successfully, but these errors were encountered: