I began to write a post on InnoDB transactions, but there was so much background material that I decided first to write a post introducing transactions, and then one on how InnoDB implements them. If there is good response from these two posts, I will continue with other posts on the major storage engines and their transactional characteristics.
When reading through literature about RDBMSs (Relational Database Management Systems), you will see the terms transaction(s), and ACID-compliance.
A transaction is a sequence of statements that are executed on a RDBMS. For a transaction to be completed and database changes made permanent, a transaction has to be completed in its entirety. If a transaction is not completed for any reason, it is rolled back to the original state ofÂ the database before the transaction began execution. The characteristics that define a transaction are called ACID.Â ACID stands for: Atomicity, Consistency, Isolation, and Durability.
According to Wikipedia’s article on ACID, it is “a set of properties that guarantee that database transactions are processed reliably.” It is useful to understand the different parts of ACID, so here they are briefly:
- The ability of the database to guarantee that either every part of the transaction is performed or none is performed.
- The database remaining in a consistent state before the start of a transaction and after the transaction is finished.
- The ability of the database to make operations in a transaction appear isolated from other concurrent operations.
- The guarantee that once the user has been notified of success, the transaction will persist through all conditions, including system failure. Durability is frequently accomplished through writing all transactions to a log file. This log file can be “replayed” in the event of a system failure. It is only after the transaction is written to this log file that the transaction can be considered safe.
So now you have some background. Next time, we will take a look at how the InnoDB storage engine implements transactions.
Share this article
4 Responses to “Transaction Basics and ACID”
Leave a Reply