What is the transaction?
A transaction is a series of database operations that are considered to be a "single unit of work” .
The operations in a transaction either all succeed, or they all fail.
In this way, transaction supports data integrity.
ACID properties
ACID = Atomicity, Consistency, Isolation, Durability.
- Atomicity — all operations succeed or fail together. The transaction is an "atomic" unit. “All or nothing”
- Consistency — a successful transaction = no schema violations. Data will be valid by defined rules (constraints, types, length).
- Isolation — one transaction will not affected by other transaction. Transaction cannot read data from incomplete transaction. Transactions can be executed concurrently.
- Durability — once a transaction is committed it will remain in system even after crash.
Usually relational databases do support ACID transactions, and non-relational databases don’t.