The ACID model is a set of database design principles that emphasize aspects of reliability that are important for business data and mission-critical applications.

A: atomicity.原子性

Transactions are atomic units of work that can be committed or rolled back. When a transaction makes multiple changes to the database, either all the changes succeed when the transaction is committed, or all the changes are undone when the transaction is rolled back.


C: consistency.一致性

The database remains in a consistent state at all times — after each commit or rollback, and while transactions are in progress. If related data is being updated across multiple tables, queries see either all old values or all new values, not a mix of old and new values.

一个事务提交后、回滚后或者正在执行中,别的query不管在哪个阶段,获取到的数据(另一个事务修改的这部分数据) 只能 全部都是新的或者全部都是旧的数据。



I: isolation.隔离性

Transactions are protected (isolated) from each other while they are in progress; they cannot interfere with each other or see each other's uncommitted data. This isolation is achieved through the locking mechanism. Experienced users can adjust the isolation level, trading off less protection in favor of increased performance and concurrency, when they can be sure that the transactions really do not interfere with each other.

标准SQL中定义了4个事务隔离级别,不同的隔离级别对事务的处理不同:读未提交,读已提交(授权读取),可重复读,串行化。 Transaction Isolation Levels

D: durability.持久性

The results of transactions are durable: once a commit operation succeeds, the changes made by that transaction are safe from power failures, system crashes, race conditions, or other potential dangers that many non-database applications are vulnerable to. Durability typically involves writing to disk storage, with a certain amount of redundancy to protect against power failures or software crashes during write operations. (In InnoDB, the doublewrite buffer assists with durability.)