diff --git a/notes/pics/next-key-locks.png b/notes/pics/next-key-locks.png new file mode 100644 index 00000000..94cf0dee Binary files /dev/null and b/notes/pics/next-key-locks.png differ diff --git a/notes/数据库系统原理.md b/notes/数据库系统原理.md index ec7b72c6..59006f30 100644 --- a/notes/数据库系统原理.md +++ b/notes/数据库系统原理.md @@ -362,6 +362,8 @@ SELECT c FROM t WHERE c BETWEEN 10 and 20 FOR UPDATE; (20, +∞) ``` +

+ ## 七、关系数据库设计理论 ### 函数依赖 diff --git a/tools/diagram/src/next-key-locks.svg b/tools/diagram/src/next-key-locks.svg new file mode 100644 index 00000000..857ec22f --- /dev/null +++ b/tools/diagram/src/next-key-locks.svg @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + Next-Key Locks + + (-∞, 10] + + (10, 11] + + (11, 13] + + (13, 20] + + (20, +∞) + + + 10 + + 11 + + 13 + + 20 + -∞ + +∞ + Gap Lock (10, 11) + + Record Lock 11 = Next-Key Lock (10, 11] + + 索引值 10、11、13、20,每个区间前开后闭 +