Transactions and ACID

Lesson 18 of 20

All or nothing — watch BEGIN, COMMIT and ROLLBACK group bank transfers so they land together or not at all.

The big picture

One unit of work

A transfer is really two updates: one account down, one account up. If the second fails, the first must undo itself. Transactions make that automatic.

BEGIN

Opens a transaction. Every change after it belongs to one all-or-nothing unit.

COMMIT

Makes every change in the transaction permanent and visible to everyone.

ROLLBACK

Discards every change since BEGIN — as if nothing ever happened.

ACID

The four promises: Atomic, Consistent, Isolated, Durable. Transactions exist to keep them.