PGSql Batch/Merge Queries for Perforamnce

I currently have several queries that execute sequentially but they are somewhat independant of one another in that they dont need each others output. A psuedo code example is
// 1. Update resource A
// 2. Delete resources B which reference resource A
// 3. Insert (new) resources B referencing resource A
// 1. Update resource A
// 2. Delete resources B which reference resource A
// 3. Insert (new) resources B referencing resource A
Is there a way using Drizzle ORM to batch these so that it only costs one round trip to the DB?
1 Reply
Ghaur
GhaurOP2mo ago
I could probably do something like an await Promise.all inside a transaction here But Id still like to know if what I suggested is possible.

Did you find this page helpful?