Home  >  Article  >  Database  >  What are the database isolation levels?

What are the database isolation levels?

王林
王林Original
2020-10-23 14:23:4221198browse

Database isolation levels include: 1. Read uncommitted; 2. Read committed; 3. Repeatable read; 4. Serialization. Lower isolation levels generally support higher concurrency and have lower system overhead.

What are the database isolation levels?

The operating environment of this article: Windows7 system, Dell G3 computer, mysql8.

1. The concept of transaction

A series of operations in a transaction either all succeed or none of them are done.

There are two ways to end a transaction. When all steps in the transaction are successfully executed, the transaction is committed. If one of the steps fails, a rollback operation occurs, undoing the actions performed by the transaction.

2. Characteristics of transactions ACID

Transactions have four characteristics: atomicity (Atomicity), consistency (Consistency), isolation (Isolation) and durability (Durability), referred to as ACID properties.

3. Problems with concurrent execution of multiple transactions

(1) Dirty read: Transaction 1 updated the record but did not commit it. Transaction 2 read the updated row, and then transaction T1 returned Roll, now T2 read is invalid.

(2) Non-repeatable read: When transaction 1 reads the record, transaction 2 updates the record and submits it. When transaction 1 reads again, you can see the modified record of transaction 2;

(3) Phantom reading: When transaction 1 reads records, transaction 2 adds records and submits them. When transaction 1 reads again, you can see the records added by transaction 2;

4. Four isolation levels of transactions

The SQL standard defines four types of isolation levels, including some specific rules to limit which changes inside and outside the transaction are visible and which are invisible. Lower isolation levels generally support higher concurrency and have lower system overhead.

What are the database isolation levels?

Related recommendations: mysql tutorial

(Video tutorial recommendation: mysql video tutorial)

The above is the detailed content of What are the database isolation levels?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn