In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the differences between dirty reading, phantom reading and unrepeatable reading. what is introduced in this article is very detailed and has a certain reference value. Interested friends must finish reading it!
The difference between dirty reading, phantom reading and unrepeatable reading: 1, dirty reading refers to when a transaction is accessing data and modifies the data; 2, unrepeatable reading refers to reading the same data many times within a transaction; 3. Illusory reading refers to a phenomenon that occurs when a transaction is not executed independently.
The difference between dirty reading, phantom reading, and unrepeatable reading:
1. Dirty reading: dirty reading means that when a transaction is accessing the data and has made changes to the data that have not yet been committed to the database, another transaction accesses the data and then uses the data.
two。 Unrepeatable: refers to reading the same data multiple times within a transaction. Before the transaction finishes, another transaction accesses the same data. Then, between the two reads in the first transaction, the data read by the first transaction may not be the same because of the modification of the second transaction. This happens that the data read twice within a transaction is different, so it is said to be unrepeatable. For example, an editor reads the same document twice, but the author rewrites the document between reads. When the editor reads the document for the second time, the document has changed. The original read cannot be repeated. This problem can be avoided if editors can read the document only after the author has finished writing it.
3. Illusion: a phenomenon that occurs when a transaction is not executed independently, such as when the first transaction modifies the data in a table, which involves all rows of data in the table. At the same time, the second transaction also modifies the data in the table, which inserts a row of new data into the table. In that case, later, the user who operates the first transaction will find that there are still rows of data in the table that have not been modified, as if there were hallucinations. For example, an editor changes a document submitted by the author, but when the production department merges its changes into the main copy of the document, it finds that the author has added unedited new material to the document. This problem can be avoided if no one can add new material to the document until the editors and production departments have finished working on the original document.
Supplement: Spring declarative transactions based on metadata:
The Isolation attribute supports a total of five transaction settings, as described below:
DEFAULT uses the isolation level set by the database (default), which is determined by the default setting of DBA.
READ_UNCOMMITTED will appear dirty read, non-repeatable read, phantom read (lowest isolation level, high concurrent performance)
Unrepeatable reading and phantom reading problems can occur in READ_COMMITTED (locking rows being read)
REPEATABLE_READ will read illusory (lock all rows read)
SERIALIZABLE guarantees that all things will not happen (lock table)
The key point of unrepeatable reading is to modify:
The data read from the same transaction is not the same two times.
The focus of phantom reading is to add or delete
Under the same conditions, the number of records read for the first time and the second time is not the same.
Dirty reading:
The emphasis is that the second transaction is not new enough.
The above are all the differences between dirty reading, phantom reading and unrepeatable reading. thank you for your reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.