间隙锁前开后闭
This commit is contained in:
parent
5b88733982
commit
ad5caff228
|
@ -392,14 +392,14 @@ SELECT c FROM t WHERE c BETWEEN 10 and 20 FOR UPDATE;
|
||||||
|
|
||||||
## Next-Key Locks
|
## Next-Key Locks
|
||||||
|
|
||||||
它是 Record Locks 和 Gap Locks 的结合,不仅锁定一个记录上的索引,也锁定索引之间的间隙。例如一个索引包含以下值:10, 11, 13, and 20,那么就需要锁定以下区间:
|
它是 Record Locks 和 Gap Locks 的结合,不仅锁定一个记录上的索引,也锁定索引之间的间隙,是一个前开后闭区间。例如一个索引包含以下值:10, 11, 13, and 20,那么就需要锁定以下区间:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
(-∞, 10]
|
(-∞, 10]
|
||||||
(10, 11]
|
(10, 11]
|
||||||
(11, 13]
|
(11, 13]
|
||||||
(13, 20]
|
(13, 20]
|
||||||
(20, +∞)
|
(20, +supremum]
|
||||||
```
|
```
|
||||||
|
|
||||||
# 七、关系数据库设计理论
|
# 七、关系数据库设计理论
|
||||||
|
|
Loading…
Reference in New Issue
Block a user