# Transaction Control in eXtremeDB

> A transaction is a unit of work with the database (a single logical operation on the data). eXtremeDB transactions enforce the ACID properties. The ACID model is one of the oldest and most important concepts of database theory. It establishes four goals that a database management system must strive to achieve: Atomicity, Consistency, Isolation, and Durability. No database system that fails to meet any of these four goals can be considered reliable.

> ## Atomicity

> Atomicity states that database modifications must follow an “all or nothing” rule. Each transaction is said to be “atomic.” If one part of the transaction fails, the entire transaction fails. It is critical that the database management system maintain the atomic nature of transactions in spite of any DBMS, operating system or hardware failure.

> ## Consistency

> Consistency states that only valid data will be written to the database. If, for some reason, a transaction is executed that violates the database’s consistency rules, the entire transaction will be rolled back and the database will be restored to a state consistent with those rules. On the other hand, if a transaction successfully executes, it will take the database from one state that is consistent with the rules to another state that is also consistent with the rules.

> ## Isolation

> Isolation requires that multiple transactions occurring at the same time not impact each other’s execution. For example, if Joe issues a transaction against a database at the same time that Mary issues a different transaction, both transactions should operate on the database in an isolated manner. This prevents Joe’s transaction from reading intermediate data produced as a side effect of part of Mary’s transaction that will not eventually be committed to the database. ANSI / ISO defines four possible isolation levels, three of which are supported by eXtremeDB: SERIALIZABLE, REPEATABLE READ, READ COMMITTED and READ UNCOMITTED (not supported). (For a more detailed discussion of the eXtremeDB implementation of these isolation levels, please refer to section Transaction Isolation Levels.)

> ## Durability

> Durability ensures that any transaction committed to the database will not be lost. Durability is ensured through the use of database backups and transaction logs that facilitate the restoration of committed transactions in spite of any subsequent software or hardware failures.

> ## Transaction Blocking

> eXtremeDB enforces the ACID principles by requiring that all database access is done within the context of a transaction. The transaction start and commit methods define a transaction block that is applied as a single database operation. The transaction rollback method and be called to discard any data updates that were implemented after the start without applying those changes to the database.