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 are the methods of database classification

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

Share

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

This article is to share with you about the content of database classification methods. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

Common methods of database classification

With the continuous development of the Internet, there are more and more methods that enterprises can use to deal with data and information. Today, let's take a look at several common data classification methods.

1. Read unsubmitted, Read Uncommited.

It means that one transaction reads something that has not been committed by another transaction. This situation must be avoided. Because uncommitted data from other transactions is likely to be rolled back at any time, the program should not be allowed to read uncommitted data from a transaction at any time. If you read data that has not been committed by another transaction, this is called dirty reading. To solve the problem of dirty reading, you can increase the transaction isolation level of the database and set the transaction isolation level to read committed.

2, read submitted, Read Committed.

This isolation level can solve the problem of dirty reading.

Under this isolation level, parallel execution between two uncommitted transactions is not allowed, but it allows one transaction to be executed and committed during the execution of one transaction. In this way, there will be a situation where the values of a row of data that select out twice before and after a transaction may be different. The reason for the change is that transaction 2, which was interspersed, performed a update operation on the row of data. In the same transaction, the problem that the values of the two select are different is called the unrepeatable read problem. To solve the non-repeatable read problem, you need to set the isolation level of the data to be repeatable.

3, can be read repeatedly. Repeatable Read .

Under this isolation level, the problem of non-repeatable reading can be solved.

At this isolation level, no other transactions are allowed to operate on a row of data while one transaction is using that row of data. Repeatable reads are supposed to lock the rows of the database. Under this isolation level, other transactions are still allowed to insert and delete data in the table, so it will appear. During the execution of transaction 1, if you select a row that meets a certain condition twice, if the select directly executes another transaction in these two times, and insert or delete has certain rows, there will be two different results of select that meet the same condition, and one select seems to be hallucinating. Therefore, this problem is also called illusion. To solve the phantom reading problem, you need to set the isolation level of the database to serialization.

4, serialization, Serialization.

Serialization can solve the problem of phantom reading.

It requires the execution of the transaction to be fully serial. So the efficiency of concurrency is lost.

The default isolation level for Mysql is repeatable.

All in all, there are four transaction isolation levels of data, from low to high: read uncommitted, read committed, repeatable read, and serialization. There are three problems related to the isolation level of database transactions, namely, dirty reading, non-repeatable reading, and phantom reading. The problem of dirty reading needs to be solved by reading submitted, but there is a problem of non-repeatable reading. The problem of unrepeatable reading needs to be solved by repeatable reading, but repeatable reading will have the problem of phantom reading. The problem of phantom reading needs to be solved by serialization.

Thank you for reading! What about the database classification methods to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

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