Résumé de section

    • The ACID theorem refers to a set of properties that ensure reliable transaction processing in databases. These properties guarantee that database transactions are processed accurately, even in the presence of errors, power failures, or other disruptions. ACID stands for:

    • A transaction is treated as a single, indivisible unit. Either all its operations are completed successfully, or none are applied.

      If any part of a transaction fails, the database remains unchanged, as if the transaction never occurred.

      Example:

      In a bank transfer, if money is debited from one account but cannot be credited to another due to an error, the entire transaction is rolled back.

    • A transaction ensures that the database transitions from one valid state to another, maintaining all defined rules and constraints.

      After a transaction completes, the database remains in a consistent state (e.g., constraints like unique keys, foreign keys, and checks are upheld).

      Example:

      In an inventory system, a transaction that decreases product stock cannot leave the stock in a negative state if the system enforces non-negative quantities.

    • Transactions are executed independently and transparently. The operations of one transaction do not interfere with another.

      Intermediate results of a transaction are not visible to other transactions until the transaction is committed.

      Example:

      Two customers cannot simultaneously purchase the last item in stock; the database ensures that one transaction completes before the other starts.

    • Once a transaction is committed, its results are permanent, even in the event of a system failure.

      Changes made by a committed transaction are stored reliably (e.g., written to disk or replicated).

      Example:

      After confirming a flight booking, the reservation remains intact even if the server crashes immediately afterward.