Home > database >  How to understand the mysql dirty read
How to understand the mysql dirty read

Time:09-16

Dirty read: a transaction read another transaction uncommitted data,
Have some questions want to ask next:
1. DML operation are all the data in innodb_buffer_pool data in the cache, the check point to check when the data is written to disk?
2. If the transaction in the statement has been executed, but the transaction has not yet been submitted, the data in the database has been changed, the transaction commit specific have what effect?
3. Select read data (i.e., the "data in the database") refers to the innodb_buffer_pool cached data or the data in the disk, according to the isolation level to distinguish?

Understand it if you have any questions?
Read uncommitted level, select the innodb_buffer_pool cache read data inside, so any transaction may read uncommitted data, dirty reads,
Reading level has been submitted, select use snapshot read (the snapshot read), so can only read other transactions have been submitted data in the disk + transaction itself changes but not submitted data, avoid the dirty reads,

O great god answers,

CodePudding user response:

Save the children

CodePudding user response:

I also want to know the

CodePudding user response:

refer to the second floor the rain mirror response:
I also want to know the


Read uncommitted, select go directly to main memory read inside, so you may not have read data submitted,
Read committed and repeatable read, select snapshots are read, and the data are already submitted data in the snapshot, so not happen dirty reads,
Read committed transaction) (once a select is to read the latest snapshot, so in the select inconsistent results may be many times, not repeatable read,
Repeatable read (in a transaction) every time the select is read for the first time the select read snapshot of so many times the select result is completely consistent, not happen not repeatable read, but can't read the latest submitted data,
Repeatable read under a snapshot of the read + key in the lock, lock the corresponding index record a range), also can avoid the phantom read, achieve serialization levels of isolation effect,

CodePudding user response:

"Read uncommitted level, select the innodb_buffer_pool cache read data inside, so any transaction may read uncommitted data, dirty reads," your understanding of this sentence is wrong, when reading data is read innodb_buffer_pool first and if there is a direct return, if not from disk synchronization to innodb_buffer_pool;

"If the transaction in the statement has been executed, but the transaction has not yet been submitted, the data in the database has been changed, the transaction commit specific what role", the transaction is with lock and roll back the related;

  • Related