feat: 가상화 문서들 추가

This commit is contained in:
DongHyeonka
2026-09-10 08:54:05 +09:00
parent e9f6a93327
commit 43e1aadef0
695 changed files with 153404 additions and 12754 deletions
@@ -0,0 +1,24 @@
# 컬렉션 하나만 fetch join하면 전송 행이 자식 수만큼 늘어난다
## Alternative text
feed_items와 highlights가 fetch join으로 합쳐져 전송 조인 행이 되고, 그 행이 결과 리스트로 갈 때만 루트 엔티티가 중복 제거되는 흐름.
## Long description
왼쪽에서 feed_items와 highlights 두 테이블이 highlights fetch join으로 들어간다. 조인은 부모 행을 자식 수만큼 반복한 전송 조인 행을 만든다. 그 행이 결과 리스트로 넘어갈 때 Hibernate가 루트 엔티티를 중복 제거하므로 리스트 크기만 줄고 전송 단계의 카테시안은 남는다.
## Elements and evidence
- **feed_items** (store): 부모 테이블 Evidence: L713L714.
- **highlights** (store): 자식 테이블 Evidence: L713L714.
- **highlights fetch join** (service): 컬렉션 하나만 fetch join한 루트 쿼리 Evidence: L713L715.
- **전송 조인 행** (queue): DB가 애플리케이션에 전달한 조인 카디널리티 Evidence: L714L715, L732L736.
- **결과 리스트** (sink): Hibernate 6+ 가 루트를 dedup한 뒤의 목록 Evidence: L717L719.
## Relationships
- **highlights → highlights fetch join:** 자식 행. Evidence: L713L714.
- **전송 조인 행 → 결과 리스트:** 루트 dedup. Evidence: L717L719.
- **highlights fetch join → 전송 조인 행:** 카테시안 곱. Evidence: L713L715, L732L734.
- **feed_items → highlights fetch join:** 부모 행. Evidence: L713L714.
@@ -0,0 +1,22 @@
# 컬렉션 하나만 fetch join하면 전송 행이 자식 수만큼 늘어난다
# Question: 컬렉션 하나만 fetch join했을 때 DB가 전달하는 행은 왜 늘어나는가?
direction: right
n0: "feed_items" {
shape: rectangle
}
n1: "highlights" {
shape: rectangle
}
n2: "highlights fetch join" {
shape: rectangle
}
n3: "전송 조인 행" {
shape: queue
}
n4: "결과 리스트" {
shape: rectangle
}
n0 -> n2: "부모 행"
n1 -> n2: "자식 행"
n2 -> n3: "카테시안 곱"
n3 -> n4: "루트 dedup"
@@ -0,0 +1,14 @@
digraph techviz {
graph [rankdir=LR, splines=ortho, nodesep=0.55, ranksep=0.85];
node [fontname=Helvetica, fontsize=11, margin="0.18,0.12", style="rounded,filled", fillcolor=white, color="#2d4357", penwidth=1.5];
edge [fontname=Helvetica, fontsize=10, color="#364b5f", penwidth=1.4, arrowsize=0.75];
n0 [label="feed_items", shape=box, style="rounded,filled"];
n1 [label="highlights", shape=box, style="rounded,filled"];
n2 [label="highlights fetch join", shape=box, style="rounded,filled"];
n3 [label="전송 조인 행", shape=oval, style="rounded,filled"];
n4 [label="결과 리스트", shape=box, style="rounded,filled"];
n0 -> n2 [label="부모 행", style=solid];
n1 -> n2 [label="자식 행", style=solid];
n2 -> n3 [label="카테시안 곱", style=solid];
n3 -> n4 [label="루트 dedup", style=solid];
}
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2026-07-23T00:00:00.000Z" agent="techviz-harness" version="24.7.17" type="device">
<diagram id="cartesian-row-multiplication" name="컬렉션 하나만 fetch join하면 전송 행이 자식 수만큼 늘어난다">
<mxGraphModel dx="1226" dy="357" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1226" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="n_feed-items" value="feed_items" tooltip="부모 테이블 | Evidence: L713-L714" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;shape=cylinder3;boundedLbl=1;backgroundOutline=1;fillColor=#eef6fb;" vertex="1" parent="1">
<mxGeometry x="70.0" y="60.0" width="150.0" height="90.0" as="geometry"/>
</mxCell>
<mxCell id="n_highlights" value="highlights" tooltip="자식 테이블 | Evidence: L713-L714" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;shape=cylinder3;boundedLbl=1;backgroundOutline=1;fillColor=#eef6fb;" vertex="1" parent="1">
<mxGeometry x="70.0" y="222.0" width="150.0" height="90.0" as="geometry"/>
</mxCell>
<mxCell id="n_fetch-join" value="highlights fetch join" tooltip="컬렉션 하나만 fetch join한 루트 쿼리 | Evidence: L713-L715" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry x="380.0" y="154.0" width="181.0" height="64.0" as="geometry"/>
</mxCell>
<mxCell id="n_transferred-rows" value="전송 조인 행&lt;br/&gt;Σ highlights" tooltip="DB가 애플리케이션에 전달한 조인 카디널리티 | Evidence: L714-L715, L732-L736" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="721.0" y="150.5" width="150.0" height="71.0" as="geometry"/>
</mxCell>
<mxCell id="n_result-list" value="결과 리스트&lt;br/&gt;루트 엔티티 중복 제거" tooltip="Hibernate 6+ 가 루트를 dedup한 뒤의 목록 | Evidence: L717-L719" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry x="1031.0" y="150.5" width="150.0" height="71.0" as="geometry"/>
</mxCell>
<mxCell id="e_child-into-join" value="자식 행" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_highlights" target="n_fetch-join">
<mxGeometry relative="1" as="geometry">
<mxPoint x="324.0" y="231.0" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_dedup-to-list" value="루트 dedup" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_transferred-rows" target="n_result-list">
<mxGeometry relative="1" as="geometry">
<mxPoint x="951.0" y="158.0" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_join-multiplies" value="카테시안 곱" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_fetch-join" target="n_transferred-rows">
<mxGeometry relative="1" as="geometry">
<mxPoint x="641.0" y="158.0" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_parent-into-join" value="부모 행" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_feed-items" target="n_fetch-join">
<mxGeometry relative="1" as="geometry">
<mxPoint x="324.0" y="141.0" as="offset"/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,754 @@
{
"type": "excalidraw",
"version": 2,
"source": "techviz-harness",
"elements": [
{
"id": "edge-child-into-join",
"type": "arrow",
"x": 220.0,
"y": 195.0,
"width": 160.0,
"height": 72.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 1216206905,
"version": 1,
"versionNonce": 1597740270,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
72.0
],
[
80.0,
72.0
],
[
80.0,
0.0
],
[
160.0,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-highlights",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-fetch-join",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-child-into-join",
"type": "text",
"x": 279.0,
"y": 219.0,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 676370709,
"version": 1,
"versionNonce": 468176308,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "자식 행",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "자식 행",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-dedup-to-list",
"type": "arrow",
"x": 871.0,
"y": 186.0,
"width": 160.0,
"height": 0.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 357695880,
"version": 1,
"versionNonce": 567689188,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
80.0,
0.0
],
[
80.0,
0.0
],
[
160.0,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-transferred-rows",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-result-list",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-dedup-to-list",
"type": "text",
"x": 906.0,
"y": 146.0,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 51077536,
"version": 1,
"versionNonce": 881831970,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "루트 dedup",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "루트 dedup",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-join-multiplies",
"type": "arrow",
"x": 561.0,
"y": 186.0,
"width": 160.0,
"height": 0.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 1212346453,
"version": 1,
"versionNonce": 1834884240,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
80.0,
0.0
],
[
80.0,
0.0
],
[
160.0,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-fetch-join",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-transferred-rows",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-join-multiplies",
"type": "text",
"x": 596.0,
"y": 146.0,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1408036219,
"version": 1,
"versionNonce": 1674724136,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "카테시안 곱",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "카테시안 곱",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-parent-into-join",
"type": "arrow",
"x": 220.0,
"y": 105.0,
"width": 160.0,
"height": 72.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 677525442,
"version": 1,
"versionNonce": 968142792,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
80.0,
0.0
],
[
80.0,
72.0
],
[
160.0,
72.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-feed-items",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-fetch-join",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-parent-into-join",
"type": "text",
"x": 279.0,
"y": 129.0,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 640150198,
"version": 1,
"versionNonce": 77180616,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "부모 행",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "부모 행",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-feed-items",
"type": "rectangle",
"x": 70.0,
"y": 60.0,
"width": 150.0,
"height": 90.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1553680117,
"version": 1,
"versionNonce": 1528008093,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-feed-items",
"type": "text",
"x": 80.0,
"y": 70.0,
"width": 130.0,
"height": 70.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1561637253,
"version": 1,
"versionNonce": 189981097,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "feed_items",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "feed_items",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-highlights",
"type": "rectangle",
"x": 70.0,
"y": 222.0,
"width": 150.0,
"height": 90.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 281310605,
"version": 1,
"versionNonce": 933280984,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-highlights",
"type": "text",
"x": 80.0,
"y": 232.0,
"width": 130.0,
"height": 70.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1591294741,
"version": 1,
"versionNonce": 457414640,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "highlights",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "highlights",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-fetch-join",
"type": "rectangle",
"x": 380.0,
"y": 154.0,
"width": 181.0,
"height": 64.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 483696978,
"version": 1,
"versionNonce": 1765028494,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-fetch-join",
"type": "text",
"x": 390.0,
"y": 164.0,
"width": 161.0,
"height": 44.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1579442861,
"version": 1,
"versionNonce": 1503566175,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "highlights fetch join",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "highlights fetch join",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-transferred-rows",
"type": "rectangle",
"x": 721.0,
"y": 150.5,
"width": 150.0,
"height": 71.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#f3f0ff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 879888391,
"version": 1,
"versionNonce": 281248584,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-transferred-rows",
"type": "text",
"x": 731.0,
"y": 160.5,
"width": 130.0,
"height": 51.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 206593575,
"version": 1,
"versionNonce": 1527179395,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "전송 조인 행\nΣ highlights",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "전송 조인 행\nΣ highlights",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-result-list",
"type": "rectangle",
"x": 1031.0,
"y": 150.5,
"width": 150.0,
"height": 71.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1585402317,
"version": 1,
"versionNonce": 1496949922,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-result-list",
"type": "text",
"x": 1041.0,
"y": 160.5,
"width": 130.0,
"height": 51.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 661544278,
"version": 1,
"versionNonce": 768805970,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "결과 리스트\n루트 엔티티 중복 제거",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "결과 리스트\n루트 엔티티 중복 제거",
"autoResize": true,
"lineHeight": 1.25
}
],
"appState": {
"gridSize": 10,
"viewBackgroundColor": "#ffffff",
"currentItemFontFamily": 5
},
"files": {}
}
@@ -0,0 +1,32 @@
{
"harness_version": "0.2.0",
"spec_id": "cartesian-row-multiplication",
"spec_version": "1.1",
"spec_sha256": "9561f8e6385ab7730a18c900c3977fbeb0e319e62195620afdadef2be0107bb6",
"source_context": {
"document": "docs/n+1liner/final/document.md",
"document_sha256": "385ca44db5bf763cb1ff28a67d531d68876402b35d21dc54f2bc702e8bda0053",
"anchor": {
"kind": "heading",
"value": "9.3 실패 ② 컬렉션 하나만 fetch join → 카테시안으로 전송 행수 증가",
"line": 711
}
},
"outputs": [
"cartesian-row-multiplication.svg",
"cartesian-row-multiplication.drawio",
"cartesian-row-multiplication.mmd",
"cartesian-row-multiplication.d2",
"cartesian-row-multiplication.dot",
"cartesian-row-multiplication.excalidraw",
"cartesian-row-multiplication.alt.md"
],
"lint_issue_count": 0,
"assumption_count": 0,
"assumptions_allowed": false,
"composition_profile": "component-flow",
"reference_ids": [
"payment-event-flow"
],
"diagram_only": true
}
@@ -0,0 +1,12 @@
%% 컬렉션 하나만 fetch join하면 전송 행이 자식 수만큼 늘어난다
%% question: 컬렉션 하나만 fetch join했을 때 DB가 전달하는 행은 왜 늘어나는가?
flowchart LR
n0["feed_items"]
n1["highlights"]
n2["highlights fetch join"]
n3(["전송 조인 행"])
n4["결과 리스트"]
n0 -->|"부모 행"| n2
n1 -->|"자식 행"| n2
n2 -->|"카테시안 곱"| n3
n3 -->|"루트 dedup"| n4
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1226" height="357" viewBox="0 0 1226 357" role="img" aria-labelledby="diagram-title diagram-description">
<title id="diagram-title">컬렉션 하나만 fetch join하면 전송 행이 자식 수만큼 늘어난다</title>
<desc id="diagram-description">왼쪽에서 feed_items와 highlights 두 테이블이 highlights fetch join으로 들어간다. 조인은 부모 행을 자식 수만큼 반복한 전송 조인 행을 만든다. 그 행이 결과 리스트로 넘어갈 때 Hibernate가 루트 엔티티를 중복 제거하므로 리스트 크기만 줄고 전송 단계의 카테시안은 남는다.</desc>
<metadata>{&quot;techviz&quot;:{&quot;spec_version&quot;:&quot;1.1&quot;,&quot;id&quot;:&quot;cartesian-row-multiplication&quot;,&quot;profile&quot;:&quot;component-flow&quot;},&quot;source_context&quot;:{&quot;document&quot;:&quot;docs/n+1liner/final/document.md&quot;,&quot;document_sha256&quot;:&quot;385ca44db5bf763cb1ff28a67d531d68876402b35d21dc54f2bc702e8bda0053&quot;,&quot;anchor&quot;:{&quot;kind&quot;:&quot;heading&quot;,&quot;value&quot;:&quot;9.3 실패 ② 컬렉션 하나만 fetch join → 카테시안으로 전송 행수 증가&quot;,&quot;line&quot;:711}},&quot;evidence_policy&quot;:&quot;Each factual element cites source lines or is marked assumption.&quot;,&quot;diagram_only&quot;:true}</metadata>
<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>
<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.style-dashed, .edge.semantic-dashed, .edge.assumption { stroke-dasharray: 7 5; }
.edge.style-dotted { stroke-dasharray: 2 5; }
.edge.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
.edge.emphasis-muted { stroke: #9ca3af; }
.edge.emphasis-warning, .edge.kind-failure, .edge.kind-error { stroke: #dc2626; stroke-width: 2.2; }
.edge-label-bg { fill: #ffffff; }
.edge-label { font-size: 12px; font-weight: 560; text-anchor: middle; }
.node-shape { fill: #ffffff; stroke: #4b5563; stroke-width: 1.7; }
.node-shape.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
.node-shape.emphasis-muted { stroke: #9ca3af; fill: #f9fafb; }
.node-shape.emphasis-warning { stroke: #d97706; stroke-width: 2; fill: #fffdf5; }
.node-shape.kind-database, .node-shape.kind-datastore, .node-shape.kind-storage { fill: #f8fafc; }
.node-shape.kind-queue, .node-shape.kind-event, .node-shape.kind-topic { fill: #fafafa; }
.node-shape.assumption { stroke-dasharray: 4 4; }
.storage-bottom, .controller-divider { fill: none; stroke: #4b5563; stroke-width: 1.4; }
.controller-led { fill: #4b5563; }
.actor-symbol { fill: none; stroke: #4b5563; stroke-width: 1.8; stroke-linecap: round; }
.actor-symbol.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
.node-label { font-size: 14px; font-weight: 650; text-anchor: middle; }
.node-role { font-size: 10px; letter-spacing: 0.04em; text-anchor: middle; fill: #6b7280; }
.node-detail-divider { stroke: #d1d5db; stroke-width: 1; }
.node-detail { font-size: 11px; fill: #374151; }
.assumption-badge { font-size: 9px; font-weight: 700; fill: #92400e; }
.failure-mark { stroke: #dc2626; stroke-width: 4; stroke-linecap: round; }
.lifeline { stroke: #9ca3af; stroke-width: 1.2; stroke-dasharray: 5 5; }
.timeline-axis { stroke: #374151; stroke-width: 1.8; marker-end: url(#arrow); }
.timeline-stem { stroke: #6b7280; stroke-width: 1.3; }
.timeline-marker { fill: #ffffff; stroke: #374151; stroke-width: 1.7; }
.timeline-marker.primary { fill: #2563eb; stroke: #2563eb; }
.timeline-marker.warning { fill: #dc2626; stroke: #dc2626; }
.timeline-label { font-size: 13px; font-weight: 650; text-anchor: middle; }
.timeline-detail { font-size: 11px; fill: #4b5563; text-anchor: middle; }
</style>
</defs>
<rect class="canvas" width="1226" height="357" />
<polyline class="edge kind-read style-solid emphasis-normal" points="220.0,267.0 300.0,267.0 300.0,195.0 380.0,195.0" data-evidence="713-714" />
<rect class="edge-label-bg" x="301.6" y="217.0" width="44.8" height="22" rx="3" />
<text class="edge-label" x="324.0" y="232.0">자식 행</text>
<polyline class="edge kind-transform style-dashed emphasis-normal" points="871.0,186.0 951.0,186.0 951.0,186.0 1031.0,186.0" data-evidence="717-719" />
<rect class="edge-label-bg" x="915.2" y="144.0" width="71.6" height="22" rx="3" />
<text class="edge-label" x="951.0" y="159.0">루트 dedup</text>
<polyline class="edge kind-transfer style-solid emphasis-normal" points="561.0,186.0 641.0,186.0 641.0,186.0 721.0,186.0" data-evidence="713-715,732-734" />
<rect class="edge-label-bg" x="611.9" y="144.0" width="58.2" height="22" rx="3" />
<text class="edge-label" x="641.0" y="159.0">카테시안 곱</text>
<polyline class="edge kind-read style-solid emphasis-normal" points="220.0,105.0 300.0,105.0 300.0,177.0 380.0,177.0" data-evidence="713-714" />
<rect class="edge-label-bg" x="301.6" y="127.0" width="44.8" height="22" rx="3" />
<text class="edge-label" x="324.0" y="142.0">부모 행</text>
<g id="node-feed-items">
<rect class="node-shape kind-store emphasis-normal role-store" data-evidence="713-714" x="70.0" y="73.0" width="150.0" height="64.0" /><ellipse class="node-shape kind-store emphasis-normal role-store" cx="145.0" cy="73.0" rx="75.0" ry="13.0" /><path class="storage-bottom" d="M 70.0 137.0 A 75.0 13.0 0 0 0 220.0 137.0" />
<text class="node-label" x="145.0" y="103.0">feed_items</text>
</g>
<g id="node-highlights">
<rect class="node-shape kind-store emphasis-normal role-store" data-evidence="713-714" x="70.0" y="235.0" width="150.0" height="64.0" /><ellipse class="node-shape kind-store emphasis-normal role-store" cx="145.0" cy="235.0" rx="75.0" ry="13.0" /><path class="storage-bottom" d="M 70.0 299.0 A 75.0 13.0 0 0 0 220.0 299.0" />
<text class="node-label" x="145.0" y="265.0">highlights</text>
</g>
<g id="node-fetch-join">
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="713-715" x="380.0" y="154.0" width="181.0" height="64.0" rx="7" />
<text class="node-label" x="470.5" y="184.0">highlights fetch join</text>
</g>
<g id="node-transferred-rows">
<rect class="node-shape kind-queue emphasis-primary role-queue" data-evidence="714-715,732-736" x="721.0" y="150.5" width="150.0" height="71.0" rx="7" />
<text class="node-label" x="796.0" y="177.5">전송 조인 행</text>
<line class="node-detail-divider" x1="735.0" y1="198.5" x2="857.0" y2="198.5" />
<text class="node-detail" x="737.0" y="215.5">Σ highlights</text>
</g>
<g id="node-result-list">
<rect class="node-shape kind-sink emphasis-normal role-sink" data-evidence="717-719" x="1031.0" y="150.5" width="150.0" height="71.0" rx="7" />
<text class="node-label" x="1106.0" y="177.5">결과 리스트</text>
<line class="node-detail-divider" x1="1045.0" y1="198.5" x2="1167.0" y2="198.5" />
<text class="node-detail" x="1047.0" y="215.5">루트 엔티티 중복 제거</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.5 KiB