IssueRaiser

Add option to skip unnecessary `SELECT` after `create()`

## 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.

Posted by ziimakc on Nov 12, 2020, 8:31 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

reliability (Other)

Add option to skip unnecessary `SELECT` after `create()`

ziimakcNov 12, 2020, 8:31 PM

## 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.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue