COMMIT

Saves all of a Transaction's changes permanently. Its opposite is ROLLBACK, which undoes them; permanence after COMMIT is the Durability in ACID.

sql
BEGIN;
UPDATE account SET balance = balance - 100 WHERE account_id = 1;
UPDATE account SET balance = balance + 100 WHERE account_id = 2;
COMMIT;

When to use

In the reading's example, two UPDATEs move 100 between accounts and COMMIT makes the transfer permanent; on error you run ROLLBACK instead.

See Read 01.

Appears in

No references yet.