Oleg Yarin
11/14/2021, 5:10 PMprisma.create
:
await this.prisma.statement.create({
data: {
contextId,
content: statementData.content,
},
});
It seems that prisma sends two SQL queries to database:
prisma:query INSERT INTO "public"."Statement" ("content","contextId","createdAt") VALUES ($1,$2,$3) RETURNING "public"."Statement"."id"
prisma:query SELECT "public"."Statement"."id", "public"."Statement"."content", "public"."Statement"."contextId", "public"."Statement"."createdAt" FROM "public"."Statement" WHERE "public"."Statement"."id" = $1 LIMIT $2 OFFSET $3
Is there a way to exclude sending a second query in this scenario?Ryan
11/15/2021, 6:03 AMcreate
.
For an update, the first statement is unnecessary, and we will be looking into this as per this request 🙂Oleg Yarin
11/15/2021, 10:55 AMSELECT "public"."Statement"."id", "public"."Statement"."content", "public"."Statement"."contextId", "public"."Statement"."createdAt" FROM "public"."Statement" WHERE "public"."Statement"."id" = $1 LIMIT $2 OFFSET $3
?
if it always has all the data after the first query (that contains RETURNING
) I would assume the second one is obsoleteRyan
11/15/2021, 11:08 AMreturning
would most likely be removed, but you can check this request for more info.