Prisma
prisma.io › home › relation queries › relation queries › relation queries › relation queries
Relation queries (Concepts) | Prisma Documentation
Prisma Client supports two load ... data with a single query to the database. query: Sends multiple queries to the database (one per table) and joins them on the application level....
GitHub
github.com › prisma › prisma › discussions › 12715
Performance: How to make prisma perform a single SQL query with joins instead of multiple queries · prisma/prisma · Discussion #12715
Which seems unlikely but I'd really like to hear the Prisma team say all is transactional, not just the special cases listed on the doco page I referenced above. Beta Was this translation helpful? Give feedback. ... There was an error while loading. Please reload this page. Something went wrong. There was an error while loading. Please reload this page. ... In order for the nested case to be successful, the nested queries should be run as subqueries (or joins instead).
Author prisma
express - how to run multiple queries in one call in prisma orm with postgresql - Stack Overflow
I am using Prisma 4.13 version with PostgreSQL & express for backend. The back-end code needs to run 3-5 queries in API to get data. I want to run all these queries in one call. This is to save... More on stackoverflow.com
Multiple queries in prisma graphql resolver - Stack Overflow
Following this example here: https://github.com/prisma/prisma-examples/blob/latest/javascript/graphql-sdl-first/src/schema.js Let's say I have a mutation where I want to update multiple users by pa... More on stackoverflow.com
Batch multiple Client queries into one Engine request (GraphQL Query)
Problem The Query engine supports a MultiQuery graphql query. This can be used to group unrelated queries against the database into one Graphql query. The Query Engine will then run each of these q... More on github.com
Why multiple queries for returning data + count?
I see answers such as #8103 and #3087 which both essentially recommend executing the two calls separately, in a transaction to return both the data + dataCount. This does work and thank you for she... More on github.com
Stack Overflow
stackoverflow.com › questions › 77878120 › how-to-run-multiple-queries-in-one-call-in-prisma-orm-with-postgresql
express - how to run multiple queries in one call in prisma orm with postgresql - Stack Overflow
Sign up to request clarification or add additional context in comments. ... Save this answer. ... Show activity on this post. Currently you cannot send multiple queries in single prisma call.
Stack Overflow
stackoverflow.com › questions › 73857879 › multiple-queries-in-prisma-graphql-resolver
Multiple queries in prisma graphql resolver - Stack Overflow
September 26, 2022 - I know the updateMany would probably be the most suitable option, but since different users would have different values, not sure how to pass that without calling multiple resolvers separately. Something like this: updateUsers: (_parent, args, context) => { return context.prisma.user.updateMany({ where: { id: { in: args.userIds }, }, data: { email: ???
GitHub
github.com › prisma › prisma › issues › 12688
Batch multiple Client queries into one Engine request (GraphQL Query) · Issue #12688 · prisma/prisma
April 6, 2022 - But when running those queries against the PDP this would be a nice improvement as it would mean that multiple queries are done using a single HTTP request. Given the following queries: let p1 = prisma.users.findMany({where: {age: 40}}); let p2 = prisma.blog.findMany({where: {title: "cats"}}); let p3 = prisma.product.findMany({where: {name: "crocs"}}); await Promise.allSettled([p1, p2, p3]); Internally the Prisma Client would convert those into a single Graphql statement like this: { batch: [ "{ findManyUser(where: {age: 40}) { id } }", "{ findManyBlog(where: {title: "cats"}) { id } }", "{ findManyProduct(where: {title: "crocs"}) { id } }", ], transaction: false } This code is then executed here in the query engine and a batch result would be returned that the user could use.
Author prisma
GitHub
github.com › prisma › prisma › issues › 2868
`$executeRaw` could support multiple queries from a single string · Issue #2868 · prisma/prisma
June 26, 2020 - db.executeRaw could support running multiple queries instead of only one ... kind/featureA request for a new feature.A request for a new feature.topic: raw$queryRaw(Unsafe) and $executeRaw(Unsafe): https://www.prisma.io/docs/concepts/components/prisma-cli$queryRaw(Unsafe) and $executeRaw(Unsafe): https://www.prisma.io/docs/concepts/components/prisma-clitopic: transaction
Author prisma
Prisma Client Python
prisma-client-py.readthedocs.io › en › stable › reference › operations
Query Operations - Prisma Client Python - Read the Docs
In lieu of more extensive documentation, this page documents query operations on the prisma client such as creating, finding, updating and deleting records.
Answer Overflow
answeroverflow.com › m › 1101515869818986618
Why prisma do 2 seperate Queries instead of 1 left join? - Theo's Typesafe Cult
April 28, 2023 - prisma:query SELECT "public"."Session"."id", "public"."Session"."userId", "public"."Session"."refreshToken", "public"."Session"."accessToken", "public"."Session"."expiresAt", "public"."Session"."ip", "public"."Session"."userAgent", "public"."Session"."createdAt", "public"."Session"."updatedAt" FROM "public"."Session" WHERE ("public"."Session"."refreshToken" = $1 AND 1=1) LIMIT $2 OFFSET $3 prisma:query SELECT "public"."User"."id", "public"."User"."name", "public"."User"."email", "public"."User"."password", "public"."User"."clubId", "public"."User"."createdAt", "public"."User"."updatedAt" FROM "public"."User" WHERE "public"."User"."id" IN ($1) OFFSET $2 I believe this should, to optimize performance, be send as a single query with a join.
Top answer 1 of 2
7
That is not yet possible. Here's a GitHub issue that had been created you can use to monitor the feature's status and give your feedback too.
Could you also share your use case too? Your feedback will be highly appreciated as we relay it back to the team. 🙂
2 of 2
0
Prisma multiSchema is now supported as a preview feature.
See here https://www.prisma.io/docs/guides/database/multi-schema
It was introduced in version 4.3.0 https://github.com/prisma/prisma/issues/1122#issuecomment-1231773471
As the docs say you would add the preview feature...
generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"]
}
Then in your datasource you note the schemas...
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
schemas = ["schema1", "schema2"]
}
And finally in each model you add the @@schema attribute...
model User {
id Int @id
orders Order[]
profile Profile?
@@schema("schema1")
}
model Order {
id Int @id
user User @relation(fields: [id], references: [id])
user_id Int
@@schema("schema2")
}
Stack Overflow
stackoverflow.com › questions › 70223111 › how-to-query-with-prisma-multiple-inner-joins
prisma2 - How to query with Prisma multiple inner joins? - Stack Overflow
December 4, 2021 - const products = await prisma.products.findMany({ where: { is_enable: true, is_deleted: false, }, include: { items: { where: { is_deleted: false }, include: { parts: { where: { is_deleted: false, }, include: { subvehicles: { include: { vehicles: { include: { manufacturers: true } } } } } } } } }, skip: replacements.offset, take: replacements.limit, });