Bytes ----------------------------------------------------------------------------------------
1. Missing or overwriting updates
When two or more transactions select the same row and update the row based on the originally selected value, the update will be lost. Every transaction does not know the existence of other transactions. The last update will overwrite the updates made by other firms, which will lead to data loss.
Example:
Transaction A and transaction B Modify the value of A row at the same time,
Transaction A changes the value to 1, commit transaction B, change the value to 2, and commit.
When the value of data is 2, the update made by transaction A will be lost. Solution: Lock the row and allow only one update transaction to be concurrently. Bytes -----------------------------------------------------------------------------------------
2. Dirty reading: unconfirmed correlation
When the second transaction selects another row being updated, unconfirmed correlation issues will occur. The data being read by the second transaction has not been confirmed and may be changed by the transaction that updates this row.
For example: Mary's original salary is 1000. The financial staff changed Mary's salary to 8000 (but did not submit a transaction) Mary Read her salary and found that her salary was changed to 8000, happy! The financial team found that the operation was wrong, rolled back the transaction, and Mary's salary changed to 1000.
In this way, 8000 of Mary's salary is a dirty data.
Solution: if any other transaction cannot read its modified value before the first transaction is committed, this problem can be avoided. Bytes -------------------------------------------------------------------------------------------
Iii. Non-repeated read: inconsistent Analysis
When the second transaction accesses the same row multiple times and reads different data each time, an inconsistent analysis problem occurs. The inconsistent analysis is similar to the unconfirmed correlation because other transactions are also changing the data being read by the second transaction. However, in an inconsistent analysis, the data read by the second transaction is committed by a transaction that has been changed. Furthermore, the inconsistent analysis involves reading the same row multiple times (twice or more) and the information is changed by other transactions each time. Therefore, the row is read non-repeatedly.
The result of two reads before and after a transaction is inconsistent, resulting in non-repeated reads.
For example: In transaction 1, Mary reads her own salary of 1000, and the operation is not completed in transaction 2. At this time, the financial personnel changed Mary's salary to 2000, and committed the transaction. in transaction 1, when Mary reads her salary again, the salary changes to 2000.
Solution: this problem can be avoided if the data can be read only after the transaction is completely committed.
Bytes --------------------------------------------------------------------------------------------
Iv. Fantasy reading
A phantom reading problem occurs when a row is inserted or deleted and the row belongs to the row being read by a transaction. The row range for the first read of the transaction shows that one row no longer exists in the second read or subsequent read because the row has been deleted by other transactions. Similarly, due to the insert operation of other transactions, the second or subsequent read of the transaction shows that a row does not exist in the original read.
Example:
Currently, there are 10 employees with a salary of 1000. Transaction A reads all employees whose salaries are 1000. At this time, transaction B inserts an employee record into the employee table, and the salary is also 1000
Solution: if no new data can be added to any other transaction before the operation Transaction Completes data processing, this problem can be avoided.