{
  "id": "acid-properties",
  "title": "ACID Properties",
  "lang": "en",
  "source_lang": "en",
  "summary": "ACID properties—atomicity, consistency, isolation, and durability—define guarantees for reliable database transactions under concurrent execution and failures.",
  "category": "computer-science",
  "subcategory": "software",
  "type": "concept",
  "aliases": [
    "ACID",
    "ACID transaction properties"
  ],
  "generated_at": "2026-11-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/acid-properties/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/acid-properties/",
      "json": "https://aiwiki.page/zh/acid-properties.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "ACID properties are four guarantees associated with reliable database transactions: atomicity, consistency, isolation, and durability. Together, they describe how a transaction groups operations into a logical unit, preserves defined correctness rules, interacts with concurrent transactions, and survives failures after commitment. They are central to database management systems, although the precise guarantees provided by a product depend on its configuration, isolation level, transaction scope, and assumed failure conditions."
    },
    {
      "heading": "Transactions and the ACID model",
      "text": "A transaction is a sequence of operations treated as a single logical unit of work. It may read and modify multiple records, tables, or other database objects. A successful transaction commits, making its outcome permanent within the system’s guarantees; an unsuccessful transaction aborts, discarding its transactional changes.\n\nA transfer between two bank accounts illustrates the four properties. Suppose a transaction transfers an amount \\(x\\) from account \\(A\\) to account \\(B\\):\n\n\\[A' = A - x,\\qquad B' = B + x.\\]\n\nAtomicity requires that both updates take effect or neither does. Consistency requires that the transaction preserve applicable rules, such as conservation of the combined balance. Isolation governs what happens when other transactions access the accounts concurrently. Durability requires the committed transfer to survive the failures covered by the database’s persistence guarantees.\n\nACID is not a particular algorithm, storage format, or database architecture. Different systems implement these guarantees using different combinations of concurrency control, logging, recovery, and replication mechanisms."
    },
    {
      "heading": "Atomicity",
      "text": "Atomicity means that a transaction’s transactional effects occur completely or not at all. If a transaction fails after performing only some of its operations, those partial effects must not remain as the transaction’s final outcome.\n\nFor the account transfer, subtracting money from one account without crediting the other would violate atomicity. A transaction manager must either complete both updates or restore the relevant database state.\n\nAtomicity does not mean that all instructions execute at exactly the same instant. A transaction can take substantial time and modify many storage pages. Whether other transactions can observe intermediate changes is governed by isolation.\n\nCommon implementation techniques include:\n\n- Undo logging, which records information needed to reverse uncommitted modifications.\n- Deferred updates, which postpone installing some changes until commitment.\n- Shadow paging, which preserves an earlier page structure while constructing an updated version.\n\nAtomicity also has a defined scope. Rolling back database writes does not ordinarily retract an email, reverse an external payment, or undo a file written outside the transaction’s participating resources. Coordinating such effects requires additional protocols or application-level mechanisms."
    },
    {
      "heading": "Consistency",
      "text": "Consistency means that a transaction takes the database from one valid state to another, preserving its specified integrity rules. These rules may include data types, uniqueness requirements, relationships between records, and application-specific invariants.\n\nIn a relational database, declarative constraints can enforce some of these rules directly. A primary key identifies records uniquely, while a foreign key can require a referenced record to exist. More complex rules, such as keeping a financial ledger balanced, may require additional application logic or database procedures.\n\nConsistency is therefore a shared responsibility. The database enforces the constraints it knows about and provides transaction mechanisms, but it cannot infer every intended business rule. An otherwise fully transactional system can commit an incorrect calculation if the application expresses that calculation and no enforced constraint rejects it.\n\nConsistency also depends on concurrency behavior. Transactions that individually preserve an invariant when executed alone may violate it when interleaved under a weaker isolation level.\n\nThe word consistency has other meanings in computing. ACID consistency concerns valid database states; it is not synonymous with replicas containing identical data or with the consistency models used in distributed systems."
    },
    {
      "heading": "Isolation",
      "text": "Isolation governs how concurrent transactions interact and which effects they can observe. Its strongest conventional formulation is serializability: the outcome of concurrent committed transactions must be equivalent to some serial execution of those transactions.\n\nSerializable execution does not require transactions to run one at a time. Operations can overlap as long as their combined behavior remains equivalent to an allowed serial order.\n\nIsolation levels and anomalies\n\nMany databases expose weaker transaction isolation levels to reduce coordination costs or improve concurrency. Commonly named levels include Read Uncommitted, Read Committed, Repeatable Read, and Serializable. Their exact behavior can differ across implementations, so the level’s name alone does not fully specify its guarantees.\n\nImportant concurrency anomalies include:\n\n- Dirty reads: reading data written by a transaction that has not committed.\n- Non-repeatable reads: obtaining different values when reading the same item again because another transaction committed a change.\n- Phantom reads: obtaining a different set of matching rows when repeating a query because another transaction changed qualifying records.\n- Lost updates: one transaction’s update unintentionally overwriting another’s.\n- Write skew: transactions reading overlapping data and updating different items in a way that jointly violates an invariant.\n\nSnapshot isolation lets transactions read a consistent snapshot and typically rejects conflicting concurrent writes to the same item. However, it is not generally serializable: write skew can remain possible.\n\nFor example, two transactions may each verify that another employee remains on call, then independently mark a different employee as off duty. Both may commit under snapshot isolation, leaving nobody on call even though each transaction appeared valid against its snapshot.\n\nConcurrency-control mechanisms\n\nIsolation can be implemented through several approaches:\n\n- Locking, which restricts conflicting access to records, ranges, or other objects.\n- Optimistic concurrency control, which allows work to proceed and checks for conflicts before commitment.\n- Multiversion concurrency control, which maintains multiple versions of data so readers and writers can operate with less blocking.\n- Serializable conflict detection, which identifies dependency patterns that could produce nonserializable execution.\n\nMultiversion storage alone does not establish a particular isolation guarantee; the rules for visibility and conflict handling matter. Serializable implementations may block transactions or abort them when necessary to preserve correctness.\n\nSerializability also does not necessarily require transaction order to respect real-world completion order. Strict serializability adds that requirement."
    },
    {
      "heading": "Durability",
      "text": "Durability means that once a transaction commits, its effects survive subsequent failures within the system’s stated failure model.\n\nA database commonly provides durability through write-ahead logging. Recovery information is made persistent before the corresponding modified data pages are allowed to become persistent. After a crash, the recovery process can reconstruct committed changes even when some updated pages had not yet reached their final storage locations.\n\nDurability does not necessarily require writing every modified database page before acknowledging commitment. Persisting sufficient recovery information can be enough. Systems may use group commit to share storage synchronization work across several transactions while retaining their durability guarantees.\n\nThe strength of durability depends on the entire persistence path, including the operating system, storage devices, caches, and configuration. A mode that acknowledges commits before the required log records reach persistent storage may lose recently acknowledged transactions after a crash.\n\nDurability is not an unconditional promise against every kind of loss. Surviving a process crash, a power failure, a disk failure, and the destruction of an entire site are different requirements. Replication and backups address additional failure scenarios, but their guarantees depend on how and when copies are made."
    },
    {
      "heading": "Distributed transactions",
      "text": "In distributed computing, a transaction may span multiple servers, partitions, or independently managed resources. Preserving ACID guarantees then requires coordination across those participants.\n\nTwo-phase commit is a classical protocol for coordinating an all-or-nothing decision. A coordinator first asks participants to prepare; it then directs them to commit or abort. In its basic form, failures can leave prepared participants waiting for a decision, potentially retaining locks or other resources.\n\nAtomic commitment and replicated agreement solve related but distinct problems. A consensus algorithm can help maintain a replicated decision or database state despite certain failures, but it does not by itself provide every aspect of transaction isolation, integrity checking, and cross-resource atomicity.\n\nDistributed ACID transactions generally require communication and coordination. This can increase latency and reduce availability during some failures. Nevertheless, distribution does not inherently rule out ACID guarantees: distributed databases can provide strongly isolated, durable transactions when their protocols and operational assumptions support them."
    },
    {
      "heading": "Relationship to other database concepts",
      "text": "ACID and CAP\n\nThe CAP theorem concerns the limits of simultaneously providing a particular form of consistency and availability during a network partition. Its consistency condition is usually expressed through linearizability, not through ACID’s definition of consistency.\n\nConsequently, ACID and CAP are not opposing classifications. ACID describes transaction guarantees, whereas CAP addresses a specific limitation in distributed operation.\n\nACID and eventual consistency\n\nEventual consistency generally means that replicas converge if updates cease and communication continues under the model’s assumptions. It does not specify the atomicity or isolation of individual transactions.\n\nA system can provide ACID transactions within one node or partition while replicating their results asynchronously elsewhere. Conversely, a system can replicate individual operations strongly without supporting general multi-operation transactions.\n\nACID and database categories\n\nACID is historically associated with relational databases and SQL, but it is not restricted to them. Some NoSQL databases support multi-record transactions, while some relational systems offer weaker durability settings or default isolation levels below Serializable.\n\nClaims of “ACID compliance” therefore need a scope: the guarantee may apply to a single record, one partition, an entire database, or multiple participating systems."
    },
    {
      "heading": "Historical development",
      "text": "The underlying ideas developed through research on transaction processing, concurrency control, and database recovery during the 1970s and early 1980s. Work on systems such as System R helped establish practical transaction-processing techniques.\n\nTheo Härder and Andreas Reuter introduced the acronym ACID in their 1983 paper Principles of Transaction-Oriented Database Recovery. Their formulation brought together properties that had already emerged in transaction-processing research.\n\nACID subsequently became a standard vocabulary for describing database reliability. It remains a framework of guarantees rather than a single certification standard: evaluating a system requires examining its documented behavior, supported transaction boundaries, isolation settings, persistence configuration, and failure assumptions."
    }
  ],
  "links": [
    "database-transaction",
    "database-management-system",
    "algorithm",
    "relational-database",
    "primary-key",
    "foreign-key",
    "write-ahead-logging",
    "operating-system",
    "data-backup",
    "distributed-computing",
    "cap-theorem",
    "eventual-consistency",
    "sql",
    "nosql"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}