Show in graph
DB

Software → Databases

Transaction

A unit of database work that groups operations into a consistent commit or rollback boundary.

Where it fits

A transaction groups database operations into a unit of work. It is essential for preserving correctness when multiple reads/writes must succeed or fail together.

Mental model

A transaction creates a boundary: either the intended set of changes is committed, or the database rolls them back.

Example

Moving money between accounts should debit one account and credit another in one transaction. Half-completed transfers are unacceptable.

Common mistakes

  • Holding transactions open too long.
  • Assuming all isolation levels behave the same.
  • Forgetting that distributed transactions are much harder than local ones.

ACID, isolation level, write-ahead log, concurrency control, database.