[Database] MySql data reading problem

Dirty read

Chronologically Transfer Withdrawals
1 Open affairs
2 Open affairs
3 Balance inquiries 10000
4 Withdrawals of 1,000 yuan, 9000 yuan balance
5 Query limit 9000 yuan
6 An unknown error has occurred, things happen rolled back 10,000 yuan
7 2000 came into updating the new balance of 11,000
8 Submit things
Normal logic 12,000 yuan

Non-repeatable read

Time slice A transaction Transaction B
1 Open affairs
2 The first query, the balance of 10,000 yuan
3 Open affairs
4 operating
5 Changed the balance of 20,000 yuan
6 Commit the transaction
7 Queries balance of 20,000 yuan
The results of previous inquiries and a post should be consistent

Magic Reading

statistics

Time slice A transaction Transaction B
1 Open affairs
2 First count, the data amount 100
3 Open affairs
4 other things
5 Insert 100 data
6 submit
7 The second is 200
Magic Reading
pip install pymysql -i https:/pypi.douban.com/simple
Published 116 original articles · won praise 10 · views 1363

Guess you like

Origin blog.csdn.net/weixin_44727383/article/details/104954766