间隙锁前开后闭

This commit is contained in:
RilaShu 2019-09-09 11:47:06 +08:00
parent 5b88733982
commit ad5caff228

View File

@ -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]
``` ```
# 关系数据库设计理论 # 关系数据库设计理论