Update 数据库系统原理.md

补充 Next-Key Locks 锁定区间的示意图。
This commit is contained in:
CyC2018
2026-10-25 19:34:22 +08:00
parent e3e2351a2f
commit 734115be54
3 changed files with 61 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+2
View File
@@ -362,6 +362,8 @@ SELECT c FROM t WHERE c BETWEEN 10 and 20 FOR UPDATE;
(20, +∞)
```
<div align="center"> <img src="pics/next-key-locks.png" width="560px"/> </div><br>
## 七、关系数据库设计理论
### 函数依赖
+59
View File
@@ -0,0 +1,59 @@
<svg xmlns="http://www.w3.org/2000/svg" width="620" height="230" viewBox="0 0 620 230">
<style>
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #666; font-size: 12px; }
.title { font-weight: bold; font-size: 15px; fill: #777; text-anchor: middle; }
.b { font-weight: bold; }
.c { text-anchor: middle; }
.e { text-anchor: end; }
.note { fill: #C0605A; }
.ok { fill: #6A9F68; }
.sub { font-size: 11px; fill: #888; }
.mono { font-family: Menlo, Consolas, monospace; }
.arrow { stroke: #666; stroke-width: 1.3; fill: none; marker-end: url(#a); }
.red { stroke: #C0605A; marker-end: url(#r); }
.green { stroke: #6A9F68; marker-end: url(#g); }
.dash { stroke-dasharray: 5 4; }
.line { stroke: #666; stroke-width: 1.3; fill: none; }
.frame { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }
.shadow { fill: #C0C0C0; }
</style>
<defs>
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#666" stroke-width="1.6"/>
</marker>
<marker id="r" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#C0605A" stroke-width="1.6"/>
</marker>
<marker id="g" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#6A9F68" stroke-width="1.6"/>
</marker>
</defs>
<rect width="100%" height="100%" fill="#FFFFFF"/>
<text x="310" y="28" class="title">Next-Key Locks</text>
<rect x="40" y="106" width="110" height="28" fill="#D8ECF5"/>
<text x="95" y="160" class="c mono">(-∞, 10]</text>
<rect x="150" y="106" width="105" height="28" fill="#C9E6EC"/>
<text x="202.5" y="160" class="c mono">(10, 11]</text>
<rect x="255" y="106" width="105" height="28" fill="#D8ECF5"/>
<text x="307.5" y="160" class="c mono">(11, 13]</text>
<rect x="360" y="106" width="105" height="28" fill="#C9E6EC"/>
<text x="412.5" y="160" class="c mono">(13, 20]</text>
<rect x="465" y="106" width="115" height="28" fill="#D8ECF5"/>
<text x="522.5" y="160" class="c mono">(20, +∞)</text>
<line x1="30" y1="120" x2="590" y2="120" class="line"/>
<circle cx="150" cy="120" r="6" fill="#61646B"/>
<text x="150" y="98" class="c b">10</text>
<circle cx="255" cy="120" r="6" fill="#61646B"/>
<text x="255" y="98" class="c b">11</text>
<circle cx="360" cy="120" r="6" fill="#61646B"/>
<text x="360" y="98" class="c b">13</text>
<circle cx="465" cy="120" r="6" fill="#61646B"/>
<text x="465" y="98" class="c b">20</text>
<text x="40" y="98" class="c sub">-∞</text>
<text x="580" y="98" class="c sub">+∞</text>
<text x="202" y="196" class="c note">Gap Lock (10, 11)</text>
<text x="255" y="214" class="c">+ Record Lock 11 = Next-Key Lock (10, 11]</text>
<path d="M202,184 L202,166" class="arrow red"/>
<text x="310" y="60" class="c sub">索引值 10、11、13、20,每个区间前开后闭</text>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB