ACID
Also known as: ACID transactions, ACID properties
Set of four properties, atomicity, consistency, isolation and durability, that guarantee database transactions are processed reliably.
ACID describes the guarantees a database makes about transactions, groups of operations treated as a single unit of work. Atomicity means a transaction happens completely or not at all: when money moves between two bank accounts, the debit and the credit either both occur or neither does. Consistency means a transaction takes the database from one valid state to another, respecting all defined rules. Isolation means concurrent transactions do not interfere, so each behaves as if it ran alone. Durability means that once a transaction is committed, it survives crashes and power failures.
Jim Gray described the core transaction concepts in work published around 1981, and Andreas Reuter and Theo Haerder coined the acronym ACID in a 1983 paper on database recovery. Databases implement the properties with techniques such as write-ahead logging, which records changes durably before applying them, and locking or multiversion concurrency control, which lets readers see a consistent snapshot while writers proceed. Isolation comes in levels, from read uncommitted to serializable; weaker levels improve performance but allow anomalies such as reading data that another transaction later rolls back.
ACID guarantees are why relational databases such as PostgreSQL are trusted with financial, medical and inventory records, where partial or lost updates would be unacceptable. They come at a cost in performance and scalability, especially when data is spread across many machines. Many distributed NoSQL systems instead offer BASE semantics, short for basically available, soft state and eventually consistent, though several later added ACID transactions. Applications that use weak isolation or skip transactions risk subtle race conditions, such as two customers buying the last item in stock, a classic problem of concurrency.
Key points
- Atomicity ensures a transaction completes entirely or not at all, with no partial updates.
- Isolation keeps concurrent transactions from interfering, while durability preserves committed data through crashes.
- Andreas Reuter and Theo Haerder coined the ACID acronym in 1983, building on Jim Gray's work.
- Weaker isolation levels trade correctness guarantees for performance and can allow subtle concurrency anomalies.
Related entries
Database
Organized collection of structured data stored electronically and managed by software that lets users store, query and update it reliably.
SQL
Declarative language for defining, querying and modifying data in relational databases, standardized by ANSI and ISO since the 1980s.
PostgreSQL
Free and open-source object-relational database system known for reliability, standards compliance and extensibility, descended from Berkeley's POSTGRES.
NoSQL
Broad category of databases that store data in models other than relational tables, such as documents, key-value pairs, wide columns or graphs.
Concurrency
Ability of a program or system to make progress on several tasks during overlapping time periods, whether or not they literally run simultaneously.
Race Condition
Flaw in which a system's behavior depends on the uncontrolled timing or ordering of events, such as two threads updating the same data at once.
Deadlock
Situation in which two or more processes are each waiting for another to release a resource, so that none of them can ever proceed.
SQLite
Small, self-contained, serverless SQL database engine in the public domain that is embedded in phones, browsers and many other applications.