ACID, an abbreviation for the four basic elements that a database transaction performs correctly. Contains: atomicity (atomicity), consistency (consistency), isolation (isolation), persistence (durability). A support transaction (Transaction) database system, must have these four characteristics, otherwise in the transaction process (Transaction processing) can not guarantee the correctness of the data, the transaction process may not be able to achieve the requirements of the parties.
Atomic Sex (atomicity)
All operations in the entire transaction, either complete or incomplete, cannot be stalled in the middle of the process. An error occurs during the execution of a transaction and is rolled back (Rollback) to the state before the transaction began, as if the transaction had never been performed.
Consistency (consistency)
Database integrity constraints are not compromised until the transaction is started and after the transaction ends.
Isolation (Isolation)
The execution of two transactions is mutually exclusive, and a transaction cannot see the data at a time when other transactions run.
Persistence (Durability)
After the transaction is completed, the changes made by the firm to the database are persisted in the database and are not rolled back.
An Introduction to Transaction processing
A transaction is a mechanism that ensures that multiple SQL statements are treated as a single unit of work. Transactions have the following effects:
* Consistency: Simultaneous queries and updates do not conflict with each other, and other users do not see data that has changed but has not yet been committed.
* recoverability: Once the system fails, the database automatically recovers the unfinished transaction completely.
Second business and consistency
A transaction is a unit of integrity, and the execution of a transaction transforms the database from one consistent state to another. Therefore, if the transaction is executed in isolation, but if multiple transactions are staggered, they may interfere with each other, resulting in inconsistent database status. In a multiuser environment, the database must avoid conflicting queries and updates at the same time. This is important if the data being processed can be changed by another user's modifications when the processing is running, and the processing result is ambiguous.
Uncontrolled concurrent access can produce the following errors:
1 Missing modifications (lost updates)
When multiple transactions modify a data concurrently, uncontrolled results can result in an error, and one modification overrides another.
2 Read-not repeatable
When more than one transaction accesses several data in a certain time sequence, an error is generated if the concurrent access is not controlled.
3 Dirty Reads (Dirdy DATA), read inconsistencies
4 The current value of the cursor brings confusion
The current lookup position of a transaction on a table during execution is represented by the cursor. The cursor points to the record that is currently being processed. When the record is processed, the next record is pointed to. When multiple transactions are executed concurrently, the modification of a transaction can have a negative effect, making the transaction associated with these cursors an error.
5 not released changes cause chain exit
A transaction may fail while the modification is in progress, and the modification needs to be rolled back (Rollback). Allowing other transactions to read has been modified (dirty read) before the error has been made or discovered, causing the chain to exit.
61 when a transaction is updated on a table, another transaction modifies or deletes the definition of this table.
The database automatically sets the appropriate level of locking for each transaction. For previous issues: Dirty reads, chain exits caused by unmodified modifications, and a transaction that modifies or deletes the definition of this table when it is updated on a table, the database is automatically resolved. The other three problems need to be artificially defined in the programming process or add locks to solve.