Skip to content

Instantly share code, notes, and snippets.

@cstorey
Last active January 7, 2017 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cstorey/092f98c1f472f8fb85a61bb0a94a119f to your computer and use it in GitHub Desktop.
Save cstorey/092f98c1f472f8fb85a61bb0a94a119f to your computer and use it in GitHub Desktop.
Query plan for `Q(a, b, c) <- R(a, b), S(b, c), T(a, b)`
# From https://arxiv.org/abs/1210.0481
digraph G {
rankdir=LR;
subgraph cluster_relations {
R [group="R"];
S [group="S"];
T [group="T"];
label = "relations";
}
subgraph joins {
#rankdir = TB;
subgraph cluster_a {
R_a [label="R(a,_)",group="R"];
T_a [label="T(a,_)",group="T"];
join_a[label="⨝a"];
R -> R_a -> join_a;
T -> T_a -> join_a;
label = "var a";
}
subgraph cluster_b {
S_b [label="S(b,_)",group="S"];
Ra_b [label="Ra(b)",group="R"];
join_b[label="⨝b"];
join_a -> Ra_b;
S -> S_b -> join_b;
R -> Ra_b -> join_b;
label = "var b";
}
subgraph cluster_c {
Sb_c [label="Sb(c)",group="S"];
Ta_c [label="Ta(c)",group="T"];
join_c[label="⨝c"];
join_a -> Ta_c;
join_b -> Sb_c;
S -> Sb_c -> join_c;
T -> Ta_c -> join_c;
label = "var c";
}
join_a -> result;
join_b -> result;
join_c -> result;
}
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment