Repository navigation
|
I noticed that What is the use of this? Instead of the As an example: await prismaClient.cardSet.deleteMany({ where: { steamAccountId: steamAccount.id } });This piece of code causes the first query to run, whose return values are then used in the second query: SELECT "public"."CardSet"."id" FROM "public"."CardSet" WHERE "public"."CardSet"."steamAccountId" = $1;
DELETE FROM "public"."CardSet" WHERE "public"."CardSet"."id" IN ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,...);The following seems more efficient to me: DELETE FROM "public"."CardSet" WHERE "public"."CardSet"."steamAccountId" = $1;Are there any cases where using just one simple query would not suffice? |
Replies: 2 comments 3 replies
|
The reason we run two queries is because the first query was used to prevent cascade deletes. We used to guard against cascade deletes as we didn't support that yet: #6996 Now that we do support cascade deletes via a preview feature, we will be optimising this in the future 🙂 |
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that have already been marked as answered but remain open. If this discussion still requires further input or clarification, feel free to reopen it or start a new one with updated details. Your contributions are invaluable to the community, and we’re here to help! For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and ongoing support of the Prisma community! |
@timvandam 👋
The reason we run two queries is because the first query was used to prevent cascade deletes. We used to guard against cascade deletes as we didn't support that yet: #6996
Now that we do support cascade deletes via a preview feature, we will be optimising this in the future 🙂