-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add option to skip unnecessary SELECT after create() #4246
Copy link
Copy link
Open
Labels
Description
Problem
Every time you do operation with prisma-client it will make unnecessary select and return value
Query:
db.log
.create({
data: {
smth: 1
},
select: { uuid: true }, // unnecessary select, even if you delete this line
})
Logs:
prisma:query COMMIT
prisma:query BEGIN
prisma:query INSERT INTO "public"."log" ("smth") VALUES ($1) RETURNING "public"."log"."uuid"
prisma:query SELECT "public"."log"."uuid" FROM "public"."log" WHERE "public"."log"."uuid" = $1 LIMIT $2 OFFSET $3
prisma:query COMMIT
Suggested solution
Add option to skip select after insert or update (in case of operation fail error is thrown by default)
db.log
.create({
data: {
smth: 1
},
select: false
})
Logs:
prisma:query COMMIT
prisma:query BEGIN
prisma:query INSERT INTO "public"."log" ("smth") VALUES ($1)"
prisma:query COMMIT
Alternative solution (breaking change)
Do not return anything after insert or update if select was not explicitly set.
Reactions are currently unavailable