2026-06-03 12:28:32 +02:00

123 lines
4.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

digraph QueryOpsHandPlan {
fontname = "Helvetica,Arial,sans-serif"
layout = dot
rankdir = LR
ranksep = 0.9;
nodesep = 0.7;
splines = true;
compound = true;
bgcolor = "white"
node [
fontname = "Helvetica,Arial,sans-serif",
shape = box,
style = "filled,rounded",
color = "#555555",
fillcolor = "white",
penwidth = 1.5
]
edge [
fontname = "Helvetica,Arial,sans-serif",
color = "#333333",
fontsize = 9,
fontcolor = "#555555",
labeldistance = 2.0,
penwidth = 1.2
]
subgraph cluster_inputs {
label = "Inputs (positional tables)"
style = "dashed"
color = "#888888"
fontcolor = "#555555"
margin = 18
author_table [label = <<table border="0" cellborder="0" cellspacing="0" cellpadding="4">
<tr><td align="center"><b>Table: author</b></td></tr>
<tr><td align="left" balign="left">• arity 2</td></tr>
<tr><td align="left" balign="left">• rows: (name, book)</td></tr>
</table>>, fillcolor = "#E8F4FD", color = "#2196F3"]
bestseller_table [label = <<table border="0" cellborder="0" cellspacing="0" cellpadding="4">
<tr><td align="center"><b>Table: bestseller</b></td></tr>
<tr><td align="left" balign="left">• arity 1</td></tr>
<tr><td align="left" balign="left">• rows: (book)</td></tr>
</table>>, fillcolor = "#E8F4FD", color = "#2196F3"]
price_table [label = <<table border="0" cellborder="0" cellspacing="0" cellpadding="4">
<tr><td align="center"><b>Table: price</b></td></tr>
<tr><td align="left" balign="left">• arity 2</td></tr>
<tr><td align="left" balign="left">• rows: (book, dollars)</td></tr>
</table>>, fillcolor = "#E8F4FD", color = "#2196F3"]
}
subgraph cluster_atoms {
label = "Atom Scans (scan_atom: Table × AtomPattern → Relation)"
style = "dashed"
color = "#9C27B0"
fontcolor = "#7B1FA2"
margin = 14
author_rel [label = <<table border="0" cellborder="0" cellspacing="0" cellpadding="4">
<tr><td align="center"><b>author_rel</b></td></tr>
<tr><td align="left" balign="left">pattern: [Var name, Var book]</td></tr>
<tr><td align="left" balign="left">cols: [name, book]</td></tr>
</table>>, fillcolor = "#F3E5F5", color = "#9C27B0"]
bestseller_rel [label = <<table border="0" cellborder="0" cellspacing="0" cellpadding="4">
<tr><td align="center"><b>bestseller_rel</b></td></tr>
<tr><td align="left" balign="left">pattern: [Var book]</td></tr>
<tr><td align="left" balign="left">cols: [book]</td></tr>
</table>>, fillcolor = "#F3E5F5", color = "#9C27B0"]
price_rel [label = <<table border="0" cellborder="0" cellspacing="0" cellpadding="4">
<tr><td align="center"><b>price_rel</b></td></tr>
<tr><td align="left" balign="left">pattern: [Var book, Var dollars]</td></tr>
<tr><td align="left" balign="left">cols: [book, dollars]</td></tr>
</table>>, fillcolor = "#F3E5F5", color = "#9C27B0"]
}
subgraph cluster_joins {
label = "Joins (shared cols = matching column names)"
style = "dashed"
color = "#4CAF50"
fontcolor = "#388E3C"
margin = 14
semijoin_step [label = <<table border="0" cellborder="0" cellspacing="0" cellpadding="4">
<tr><td align="center"><b>semijoin</b></td></tr>
<tr><td align="left" balign="left">authors of bestsellers</td></tr>
<tr><td align="left" balign="left">shared: book</td></tr>
<tr><td align="left" balign="left">cols: [name, book]</td></tr>
</table>>, fillcolor = "#E8F5E9", color = "#4CAF50"]
natural_join_step [label = <<table border="0" cellborder="0" cellspacing="0" cellpadding="4">
<tr><td align="center"><b>natural_join</b></td></tr>
<tr><td align="left" balign="left">attach each book's price</td></tr>
<tr><td align="left" balign="left">shared: book</td></tr>
<tr><td align="left" balign="left">cols: [name, book, dollars]</td></tr>
</table>>, fillcolor = "#E8F5E9", color = "#4CAF50"]
}
subgraph cluster_output {
label = "Output (binding relation)"
style = "dashed"
color = "#888888"
fontcolor = "#555555"
margin = 18
result [label = <<table border="0" cellborder="0" cellspacing="0" cellpadding="4">
<tr><td align="center"><b>Q result</b></td></tr>
<tr><td align="left" balign="left">authors of bestsellers with each book's price</td></tr>
<tr><td align="left" balign="left">cols: [name, book, dollars]</td></tr>
</table>>, fillcolor = "#ECEFF1", color = "#607D8B"]
}
// Atom scans consume tables
author_table -> author_rel [color = "#2196F3"]
bestseller_table -> bestseller_rel [color = "#2196F3"]
price_table -> price_rel [color = "#2196F3"]
// semijoin narrows author_rel to bestseller authors
author_rel -> semijoin_step [label = "left", color = "#9C27B0"]
bestseller_rel -> semijoin_step [label = "right", color = "#9C27B0"]
// natural_join attaches price
semijoin_step -> natural_join_step [label = "left", color = "#4CAF50"]
price_rel -> natural_join_step [label = "right", color = "#9C27B0"]
// Final output
natural_join_step -> result [color = "#4CAF50"]
}