Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the mysql transaction and isolation level?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Transaction and isolation level

The concept of transaction: transaction is a series of operations on the database as a whole, either all successful or all failed, the use of transactions we can ensure the integrity of the database, transactions are atomic.

Isolation level: the isolation level defines the isolation distance between transactions.

Dirty reads (dirty read): dirty reads occur when one transaction reads uncommitted modifications from another transaction.

Non-repeatable read (nonrepeated read): the same query is performed many times in the same transaction, and the results returned each time are different because the changes made by other transactions are committed, and non-repeatable reading occurs.

Phantom read: the same query is performed multiple times in the same transaction, resulting in different result sets each time due to additions or deletions made by other transactions or commits.

Non-repeatable reading focuses on modification, while phantom reading focuses on adding or deleting. To solve the problem of unrepeatable reading, you only need to lock the rows that meet the conditions, and to solve the phantom reading, you need to lock the table.

There are four transaction isolation levels for MySQL

Read unsubmitted (Read uncommitted)

Read submitted (Read committed)

Repeatable read (Repeated read)

Serializable (Serializable)

The default isolation level of MySQL is: repeatable (Repeated read)

These are the details of the mysql isolation level, please pay attention to other related articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report