auto commit
BIN
docs/notes/pics/26a7c9df-22f6-4df4-845a-745c053ab2e5.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/notes/pics/2959e455-e6cb-4461-aeb3-e319fe5c41db.jpg
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
docs/notes/pics/43bf0957-0386-4c09-9ad7-e163c5b62559.jpg
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
docs/notes/pics/73846795-675b-496b-88b0-d44233fdcfba.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
docs/notes/pics/8036ba3d-8de9-44aa-bf5d-1f8ca18ae89b.jpg
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
docs/notes/pics/bab0fba6-38e4-45f7-b34d-3edaad43810f.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
|
@ -48,7 +48,7 @@
|
|||
|
||||
事务指的是满足 ACID 特性的一组操作,可以通过 Commit 提交一个事务,也可以使用 Rollback 进行回滚。
|
||||
|
||||
<div align="center"> <img src="pics/bae98438-7db6-41a6-893e-8813248f2f92.jpg" width="400"/> </div><br>
|
||||
<div align="center"> <img src="pics/73846795-675b-496b-88b0-d44233fdcfba.jpg"/> </div><br>
|
||||
|
||||
## ACID
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
|||
- 在并发的情况下,多个事务并行执行,事务不仅要满足原子性,还需要满足隔离性,才能满足一致性。
|
||||
- 事务满足持久化是为了能应对数据库崩溃的情况。
|
||||
|
||||
<div align="center"> <img src="pics/6675d713-8b59-4067-ad16-fdd538d4bb43.png" width="500"/> </div><br>
|
||||
<div align="center"> <img src="pics/8036ba3d-8de9-44aa-bf5d-1f8ca18ae89b.jpg" width="700"/> </div><br>
|
||||
|
||||
## AUTOCOMMIT
|
||||
|
||||
|
@ -95,26 +95,26 @@ MySQL 默认采用自动提交模式。也就是说,如果不显式使用`STAR
|
|||
|
||||
T<sub>1</sub> 和 T<sub>2</sub> 两个事务都对一个数据进行修改,T<sub>1</sub> 先修改,T<sub>2</sub> 随后修改,T<sub>2</sub> 的修改覆盖了 T<sub>1</sub> 的修改。
|
||||
|
||||
<div align="center"> <img src="pics/d5dfeb74-a27a-43b8-9121-191d3cb75198.png" width="350"/> </div><br>
|
||||
<div align="center"> <img src="pics/26a7c9df-22f6-4df4-845a-745c053ab2e5.jpg" width="350"/> </div><br>
|
||||
|
||||
## 读脏数据
|
||||
|
||||
T<sub>1</sub> 修改一个数据,T<sub>2</sub> 随后读取这个数据。如果 T<sub>1</sub> 撤销了这次修改,那么 T<sub>2</sub> 读取的数据是脏数据。
|
||||
|
||||
<div align="center"> <img src="pics/16eea7d2-f5f5-4180-93be-dba7d4e48f5d.png" width="400"/> </div><br>
|
||||
<div align="center"> <img src="pics/bab0fba6-38e4-45f7-b34d-3edaad43810f.jpg" width="400"/> </div><br>
|
||||
|
||||
## 不可重复读
|
||||
|
||||
T<sub>2</sub> 读取一个数据,T<sub>1</sub> 对该数据做了修改。如果 T<sub>2</sub> 再次读取这个数据,此时读取的结果和第一次读取的结果不同。
|
||||
|
||||
<div align="center"> <img src="pics/036c0e07-0725-4b3c-a684-ab3b16ca7b86.png" width="400"/> </div><br>
|
||||
<div align="center"> <img src="pics/43bf0957-0386-4c09-9ad7-e163c5b62559.jpg" width="400"/> </div><br>
|
||||
|
||||
|
||||
## 幻影读
|
||||
|
||||
T<sub>1</sub> 读取某个范围的数据,T<sub>2</sub> 在这个范围内插入新的数据,T<sub>1</sub> 再次读取这个范围的数据,此时读取的结果和和第一次读取的结果不同。
|
||||
|
||||
<div align="center"> <img src="pics/2c437953-08b1-47b9-a780-7dfdc90a3b6f.png" width="400"/> </div><br>
|
||||
<div align="center"> <img src="pics/2959e455-e6cb-4461-aeb3-e319fe5c41db.jpg" width="400"/> </div><br>
|
||||
|
||||
|
||||
----
|
||||
|
|
BIN
docs/pics/26a7c9df-22f6-4df4-845a-745c053ab2e5.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/pics/2959e455-e6cb-4461-aeb3-e319fe5c41db.jpg
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
docs/pics/43bf0957-0386-4c09-9ad7-e163c5b62559.jpg
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
docs/pics/73846795-675b-496b-88b0-d44233fdcfba.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
docs/pics/8036ba3d-8de9-44aa-bf5d-1f8ca18ae89b.jpg
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
docs/pics/bab0fba6-38e4-45f7-b34d-3edaad43810f.jpg
Normal file
After Width: | Height: | Size: 32 KiB |