Files
document-haness/docs/n+1liner/final/assets/tech-log-studio/batch-fetch-in-clause.svg
T

46 lines
3.1 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="700" height="230" viewBox="0 0 700 230" role="img" aria-labelledby="diagram-title diagram-description">
<title id="diagram-title">배치 페치는 부모를 먼저 페이징하고 자식을 IN 으로 묶는다</title>
<desc id="diagram-description">왼쪽에서 엔티티만 페이징해 DB Limit이 정상 발행되고 부모 페이지가 정해진다. 가운데에서 그 페이지의 부모 키를 모아 자식을 IN 조건 한 번으로 가져온다. 오른쪽 실행계획은 준조인이라 부모와 자식을 곱하지 않고 자식 행만 반환한다. 왕복 수는 부모 수를 배치 크기로 나눈 올림값이 된다.</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" />
</marker>
<pattern id="hatch" width="7" height="7" patternTransform="rotate(45)" patternUnits="userSpaceOnUse">
<line x1="0" y1="0" x2="0" y2="7" stroke="#9ca3af" stroke-width="3" />
</pattern>
<style>
:root { color-scheme: light; }
text { font-family: Inter, Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: #111827; }
.canvas { fill: #ffffff; }
.group-box { fill: #ffffff; stroke: #9ca3af; stroke-width: 1.4; stroke-dasharray: 7 5; }
.group-label-bg { fill: #ffffff; }
.group-label { font-size: 13px; font-weight: 650; fill: #374151; }
.edge { fill: none; stroke: #374151; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; marker-end: url(#arrow); }
.edge.dashed { stroke-dasharray: 7 5; }
.edge.primary { stroke: #2563eb; stroke-width: 2.2; }
.edge.muted { stroke: #9ca3af; }
.node { fill: #ffffff; stroke: #4b5563; stroke-width: 1.7; }
.node.primary { stroke: #2563eb; stroke-width: 2.4; }
.node.muted { stroke: #9ca3af; fill: #f9fafb; }
.node.marked { stroke: #4b5563; stroke-width: 2.4; stroke-dasharray: 5 4; }
.label { font-size: 14px; font-weight: 650; text-anchor: middle; }
.fill-kept { fill: #2563eb; stroke: none; }
.fill-drop { fill: url(#hatch); stroke: #9ca3af; stroke-width: 1; }
.fill-none { fill: #ffffff; stroke: #d1d5db; stroke-width: 1; }
</style>
</defs>
<rect class="canvas" width="700" height="230" />
<rect class="node primary" x="40" y="70" width="160" height="80" rx="7" />
<text class="label" x="120.0" y="115.0">부모 페이징</text>
<rect class="node primary" x="265" y="60" width="170" height="100" rx="7" />
<text class="label" x="350.0" y="115.0">부모 키 IN</text>
<rect class="node " x="500" y="70" width="160" height="80" rx="7" />
<text class="label" x="580.0" y="115.0">준조인</text>
<polyline class="edge primary" points="200,110 265,110" />
<polyline class="edge primary" points="435,110 500,110" />
<rect class="group-box" x="20" y="178" width="660" height="40" rx="9" />
<rect class="group-label-bg" x="34" y="169" width="97.6" height="18" />
<text class="group-label" x="40" y="182">자식은 따로 가져온다</text>
</svg>