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: author |
| • arity 2 |
| • rows: (name, book) |
>, fillcolor = "#E8F4FD", color = "#2196F3"]
bestseller_table [label = <
| Table: bestseller |
| • arity 1 |
| • rows: (book) |
>, fillcolor = "#E8F4FD", color = "#2196F3"]
price_table [label = <
| Table: price |
| • arity 2 |
| • rows: (book, dollars) |
>, 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 = <
| author_rel |
| pattern: [Var name, Var book] |
| cols: [name, book] |
>, fillcolor = "#F3E5F5", color = "#9C27B0"]
bestseller_rel [label = <
| bestseller_rel |
| pattern: [Var book] |
| cols: [book] |
>, fillcolor = "#F3E5F5", color = "#9C27B0"]
price_rel [label = <
| price_rel |
| pattern: [Var book, Var dollars] |
| cols: [book, dollars] |
>, 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 = <
| semijoin |
| authors of bestsellers |
| shared: book |
| cols: [name, book] |
>, fillcolor = "#E8F5E9", color = "#4CAF50"]
natural_join_step [label = <
| natural_join |
| attach each book's price |
| shared: book |
| cols: [name, book, dollars] |
>, fillcolor = "#E8F5E9", color = "#4CAF50"]
}
subgraph cluster_output {
label = "Output (binding relation)"
style = "dashed"
color = "#888888"
fontcolor = "#555555"
margin = 18
result [label = <
| Q result |
| authors of bestsellers with each book's price |
| cols: [name, book, dollars] |
>, 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"]
}