The concept of database things

A transaction is a unit of concurrency control, a sequence of operations defined by the user. These operations are either done or not done, and they are an inseparable unit of work. Transactions allow SQL Server to bind together a logically related set of operations so that the server maintains data integrity.


A transaction usually begins with a BEGIN TRANSACTION and ends with a COMMIT or ROLLBACK.

COMMIT means commit, that is, commit all operations of the transaction. Specifically, all updates to the database in the transaction are written back to the physical database on disk, and the transaction ends normally.

ROLLBACK means rollback, that is, a certain failure occurs during the operation of the transaction, and the transaction cannot continue. The system undoes all completed operations on the database in the transaction and rolls back to the state where the transaction started.

Transaction characteristics (ACID characteristics)
A: Atomicity (Atomicity)
       transaction is the logical unit of work of the database, the operations included in the transaction are either all done or not done at all.

B: Consistency
       The result of transaction execution must be to change the database from one consistent state to another consistent state. Consistency and atomicity are closely related.

C: Isolation (Isolation)
      The execution of a transaction cannot be interfered with by other transactions.

D: Durability/Permanence (Durability)
      Once a transaction is committed, its changes to the data in the database should be permanent.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326398655&siteId=291194637