You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will perform 2 updates inside a transaction. If one fails, the transaction fails. We can speed this up by putting each update inside a Promise.all, but we are still making 3 trips to our database:
start transaction
update rows
end transaction
It would be much more efficient to do something like
db.batch([db.update(...),db.update(...)]);
Under the hood this could produce a single SQL statement that does the following:
BEGIN;
UPDATE table1 SET column_name1 ='new_value'WHERE condition1;
UPDATE table2 SET column_name2 ='new_value'WHERE condition2;
COMMIT;
Now I only have one chunk of SQL being sent to the database rather than 3.
The text was updated successfully, but these errors were encountered:
Feature hasn't been suggested before.
Describe the enhancement you want to request
Reopening #2291
Saw this was closed, but wondering why. Assume the following code:
This will perform 2 updates inside a transaction. If one fails, the transaction fails. We can speed this up by putting each update inside a Promise.all, but we are still making 3 trips to our database:
It would be much more efficient to do something like
Under the hood this could produce a single SQL statement that does the following:
Now I only have one chunk of SQL being sent to the database rather than 3.
The text was updated successfully, but these errors were encountered: