ACID: the 4 properties of database transactions

ACID is an acronym summarizing the four basic properties of a transaction within a database : Atomicity, Consistency, Insulation, Durability. Discover the precise meaning of these properties.

Within a database, the term “transaction” refers to transactions making changes to data. For example, a bank transfer that causes the sender’s account to be debited and the recipient’s account to be credited is a transaction.

However, these transactions must have four properties to ensure their validity even in the event of computer errors or failures. These four properties are atomicity, consistency, insulation and durability. In order to easily memorize these attributes, Andreas Reuter and Theo Härder invented the acronym “ACID” in 1983.

ACID: definition of the Atomicity of a database transaction

acidicity atomicity

The atomicity of transactions within databases means that tll changes to the data are fully implemented.or not at all. Either all changes made by the transaction are recorded for posterity, or none at all.

In addition, atomicity allows prevent changes from taking effect in the event of an application or database server failure in the middle of the transaction. This prevents the database from being corrupted by unpredictable, half-completed operations.

ACID: Definition of Database Transaction Consistency

acid consistency

Consistency means that transactions must comply with database data integrity constraints. Thus, a transaction that starts with a consistent data set (respecting integrity constraints) must result in a consistent data set.

To maintain consistency, a DBMS database system can discontinue transactions that could lead to inconsistency; and. Note that this consistency does not apply to the intermediate stages of the transaction.

To ensure consistency over time, it is possible to use a temporal database. This allows you to specify the data constraints that must pass through the time dimension.

ACID: Definition of Database Transaction Isolation

acid insulation

Insulation means that postings and readings of successful transactions will not be affected by the entries and readings of other transactions, whether successful or not. Isolated transactions can be “serialized”, which means that the final state of the system can be achieved by performing the transactions one by one.

To describe how insulation can be achieved, the following are often used the terms of the transactions “optimistic” or “pessimistic”… . In the case of optimistic transactions, the transaction management software generally considers other transactions to be successful and not to read or write twice in the same place. It also allows reading and writing to data modified by other transactions. If a transaction is aborted or if order conflicts occur, both transactions are reversed and reset.

In the case of pessimistic transactions, the resources are locked until the end of the transaction to prevent any interference. If one transaction requires resources used by another, it will have to wait. Often, this waiting is unnecessary and degrades performance.

In addition, there are numerous hybrid approaches combining optimistic and pessimistic transactions. This usually allows you to take advantage of the superior performance of optimistic trades, and the guaranteed progression of pessimistic trades.

ACID: definition of the Durability of a database transaction

acid durability

Finally, sustainability ensures that successful transactions will survive permanently and will not be affected by possible breakdowns or technical problems. Changes to the data must be permanent. Specifically, it is the logical effects of the changed data on future transactions that must be permanent.

Simply writing data to disk is not enough to achieve durability. For example, the disk may fail. It is DBMS needs to write logs on the changes made. These logs must be permanent, and possibly redundant.

In the event of a disk, OS or DBMS failure, the database will be restarted and the DBMS will be able to check if the data is synchronized with the logs.. Indeed, the logs contain the effects of all the transactions carried out. This is not necessarily the case for data files. If information is missing, the operations recorded in the logs will be performed again.

Be the first to comment

Leave a Reply

Your email address will not be published.