隔离级别         一致性读和锁 SQL  | Read Uncommited  | Read Commited  | Repeatable Read  | Serializable  | |
SQL  | 条件  | ||||
select  | 相等  | None locks  | Consisten read/None lock  | Consisten read/None lock  | Share locks  | 
范围  | None locks  | Consisten read/None lock  | Consisten read/None lock  | Share Next-Key  | |
update  | 相等  | exclusive locks  | exclusive locks  | exclusive locks  | Exclusive locks  | 
范围  | exclusive next-key  | exclusive next-key  | exclusive next-key  | exclusive next-key  | |
Insert  | N/A  | exclusive locks  | exclusive locks  | exclusive locks  | exclusive locks  | 
replace  | 无键冲突  | exclusive locks  | exclusive locks  | exclusive locks  | exclusive locks  | 
键冲突  | exclusive next-key  | exclusive next-key  | exclusive next-key  | exclusive next-key  | |
delete  | 相等  | exclusive locks  | exclusive locks  | exclusive locks  | exclusive locks  | 
范围  | exclusive next-key  | exclusive next-key  | exclusive next-key  | exclusive next-key  | |
Select ... from ... Lock in share mode  | 相等  | Share locks  | Share locks  | Share locks  | Share locks  | 
范围  | Share locks  | Share locks  | Share Next-Key  | Share Next-Key  | |
Select * from ... For update  | 相等  | exclusive locks  | exclusive locks  | exclusive locks  | exclusive locks  | 
范围  | exclusive locks  | Share locks  | exclusive next-key  | exclusive next-key  | |
Insert into ... Select ... (指源表锁)  | innodb_locks_unsafe_for_binlog=off  | Share Next-Key  | Share Next-Key  | Share Next-Key  | Share Next-Key  | 
innodb_locks_unsafe_for_binlog=on  | None locks  | Consisten read/None lock  | Consisten read/None lock  | Share Next-Key  | |
create table ... Select ... (指源表锁)  | innodb_locks_unsafe_for_binlog=off  | Share Next-Key  | Share Next-Key  | Share Next-Key  | Share Next-Key  | 
innodb_locks_unsafe_for_binlog=on  | None locks  | Consisten read/None lock  | Consisten read/None lock  | Share Next-Key  | |
| 欢迎光临 MariaDB社区 (http://123.56.88.72/) | Powered by Discuz! X3.2 |