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

Introduction to MySQL transactions and InnoDB lock types

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article gives you an introduction to MySQL transactions and InnoDB lock types. The article covers the knowledge of MySQL transactions and InnoDB lock types. I hope you can get something from this article.

I. isolation level of the transaction

1. 4 isolation levels

(1) uncommitted read (Read uncommitted): one transaction reads uncommitted data from other transactions, which is the lowest isolation mechanism.

(2) commit Read committed: one transaction reads the data committed by another transaction.

(3) Repeatable read: a transaction reads the same data in the same way, regardless of other transactions' modifications to the data.

(4) Serializable: transaction serialization is executed with the highest isolation level at the expense of system concurrency.

2. Problems solved by different isolation levels

If the isolation level of the transaction is not considered, the concurrency of the transaction can cause the following problems:

(1) dirty reading: transaction A reads the data updated by transaction B, and then B rolls back the operation, then the data read by An is dirty data.

(2) non-repeatable reading: transaction A reads the same data many times, and transaction B updates and commits the data in the process of reading the same data many times, resulting in inconsistent results when transaction A reads the same data many times.

(3) Phantom reading: reading the same range of data in the same transaction, but resulting in more data or less data, this is called phantom reading. (just like a transaction to id

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