read commit

Read Committed的全称是read committed rather than transaction

详见 https://docs.oracle.com/database/121/CNCPT/consist.htm#CNCPT1319

查询场景

只要其它事务有commit,无论是update/insert/delete,变更马上就能实时看到

update场景

当两个事务同时更新冲突事务时,后更新的事务会阻塞等待前者commit,前者commit后,会覆盖前者的数据

@startuml
|Trans1|
start
:begin;
:update salary=11 where ID='1' \n => OK;
|#AntiqueWhite|Trans2|
:begin;
:update salary=12 where ID='1' \n => Blocked;
|Trans1|
:commit;
|Trans2|
:1 row updated.;
:select salary where ID='1' \n => 12;
|#AntiqueWhite|Trans1|
:select salary where ID='1' \n => 12;

stop
@enduml

当两个事务同时更新不冲突的事务时,只要没有commit,就是各搞各的。

insert/delete场景