Traditional Culture Encyclopedia - Traditional customs - How do you understand things in a database that feel abstract?
How do you understand things in a database that feel abstract?
(2):Transactions usually start with BEGIN TRANSACTION and end with 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, in the process of running a transaction in the occurrence of some kind of failure, the transaction can not continue, the system will be in the transaction to complete all the operations on the database to undo all the roll back to the beginning of the transaction state.
(3):Three modes of transaction operation:
A:Auto-commit transaction
Each individual statement is a transaction. A COMMIT is implied after each statement.
B:Explicit Transactions
Start explicitly with BEGIN TRANSACTION and end explicitly with COMMIT or ROLLBACK.
C:Implicit Transaction
A new transaction is implicitly started when the previous one completes, but each transaction still ends explicitly with a COMMIT or ROLLBACK.
(4):Transaction characteristics (ACID characteristics)
A: Atomicity (Atomicity)
Transaction is the logical unit of work of the database, the transaction includes all or none of the operations.
B: Consistency (Consistency)
The result of the execution of the transaction must be to make the database from a consistent state to another consistent state. Consistency and atomicity are closely related.
C:Isolation
The execution of a transaction cannot be interfered with by other transactions.
D:Durability (Durability)
Once a transaction is committed, its changes to the data in the database should be permanent.
Note:Transaction is the basic unit of recovery and concurrency control. The basic concept of the above is also seen somewhere.
Below is an example:
Suppose a bank database has two tables, checking table (checking) and storage table (saving), now to transfer 10 million from A's checking account to his savings account, then minimum three steps are required.
1. checking the checking account balance is higher than 10 million
2. subtracting 10 million from the checking account
3. adding 10 million to the saving account
The above three steps have to be in a single transaction, and if any of the steps fails, all the steps have to be rolled back.
- Previous article:Poems written by Miao about traditional festivals in China
- Next article:What are some good English names?
- Related articles
- What month is Chinese Thanksgiving Day It's a holiday to honor martyrs
- Seeking an argumentative essay on banning fireworks
- What are the traditional martial arts boxing methods?
- Shao Guangfu Yue, the original god of playing and rewarding sharing activities.
- What is the meaning of "three sheep open Thailand"
- Hospitals to implement the spirit of the Fifth Plenary Session of the 18th Congress experience
- What material are the murals painted with?
- Why do street shopkeepers recommend using Alipay, not WeChat payment?
- What are the traditional customs of Mid-Autumn Festival?
- Traditional treatment of heart disease