Article directory
1、ACID
business principle
transaction persistence
transaction atomicity
Basic concepts of MVCC
Fundamentals of MVCC
undo log
undo log version chain
readview
MVCC implementation principle
RC read committed
RR repeatable read
MVCC implementation principle
Summarize
2. Problems caused by concurrent transactions
3. Transaction isolation level
Note : The higher the transaction isolation level, the more secure the data, but the lower the performance
4. Index
4.1. Index overview
4.2. Advantages and disadvantages of indexing
4.3. Index structure
binary tree
B-Tree tree
B+Tree tree
B+Tree optimization
Hash index
Features of Hash Index
interview questions
index classification
Clustered and Secondary Indexes
return table query
How high is the B+tree height of the InnoDB primary key index?
index syntax
slow query log
SQL performance analysis
explain execution plan
shared lock
Shared locks, also known as read locks, S locks. Going to the toilet is equivalent to modifying the operation. When a transaction adds a shared lock to a row, the row can only be read, not written. Other transactions can only add shared locks to it, not exclusive locks.
exclusive lock
Exclusive lock, also known as write lock, X lock. When an exclusive lock is added, it is equivalent to closing the door of the bathroom, and others cannot go in to wash hands, put on makeup, and the like. That is to say, write operations and read operations cannot be performed, and other transactions cannot lock it again.
Everyone's understanding of exclusive locks may be somewhat different. I made a mistake at the beginning, thinking that after an exclusive lock locks a row of data, other transactions cannot read and modify the row of data, but this is not the case. Exclusive lock means that after a transaction adds an exclusive lock to a row of data, other transactions cannot add other locks to it.
The mysql InnoDB engine defaults to modify the data statement, update, delete, insert will automatically add an exclusive lock to the data involved, the select statement will not add any lock type by default, if you add an exclusive lock, you can use the select ... for update statement to add sharing Locks can use the select ... lock in share mode statement.
so addedData rows with exclusive locks cannot be modified in other transactions, and data cannot be queried through for update and lock in share mode locks, but data can be queried directly through select...from..., because ordinary queries do not have any locking mechanism.