What does ACID mean in a database transaction?
What does ACID mean in a database transaction?
ACID is the set of guarantees a transactional database gives: Atomicity, Consistency, Isolation and Durability. Together they make a group of changes behave as one reliable unit.
| Property | Guarantee | Typical mechanism |
|---|---|---|
| Atomicity | All statements of the transaction apply, or none do | undo log, rollback |
| Consistency | A transaction moves the database from one valid state to another; constraints are never violated | constraints, foreign keys, triggers, your application rules |
| Isolation | Concurrent transactions do not see each other's half-done work | locks, MVCC (multi-version concurrency control) |
| Durability | Once committed, data survives a crash or power loss | write-ahead log (WAL / redo log) flushed to disk |
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.