diff --git a/slides/cse4562sp2018/2018-02-12-Algorithms.html b/slides/cse4562sp2018/2018-02-12-Algorithms.html index 05d59ccc..03f6c8f8 100644 --- a/slides/cse4562sp2018/2018-02-12-Algorithms.html +++ b/slides/cse4562sp2018/2018-02-12-Algorithms.html @@ -216,7 +216,15 @@ return result -

Need to evaluate rhs iterator once per record in lhs

+ + +
+

Nested-Loop Join

+ +
+ +
+

Problem: We need to evaluate rhs iterator
once per record in lhs

@@ -267,8 +275,94 @@
-

Join Conditions

+

How big should the blocks be?

+ +

What is the IO complexity of the algorithm?

+ +
+

Join Conditions

+ +

Problem: Naively, any tuple matches any other

+
+ +
+

Join Conditions

+ +

Solution: First organize the data

+
+ + + +
+ +
+

Strategies

+ +
+
Sort/Merge Join
+
Sort all of the data upfront, then scan over both sides.
+ +
In-Memory Index Join (1-pass Hash; Hash Join)
+
Build an in-memory index on one table, scan the other.
+ +
Partition Join (2-pass Hash; External Hash Join)
+
Partition both sides so that tuples don't join across partitions.
+
+
+ +
+

Sort/Merge Join

+ +
+ +
+

Hash Functions

+ + +
+ +
+

Hash Functions

+ +

+ $$h(X) \mod N$$ + +

+

+
+ +
+

1-Pass Hash Join

+ +
+ +
+

2-Pass Hash Join

+ +
+ +
+

Why is it important that the hash function is pseudorandom?

+
+
+ +
+

Next Class

+

More operators, More algorithms

diff --git a/slides/cse4562sp2018/graphics/2018-02-12-Join-1PassHash.svg b/slides/cse4562sp2018/graphics/2018-02-12-Join-1PassHash.svg new file mode 100644 index 00000000..8fa80c73 --- /dev/null +++ b/slides/cse4562sp2018/graphics/2018-02-12-Join-1PassHash.svg @@ -0,0 +1,430 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + h(A) = 0 + h(A) = 1 + + + + + 1 + + + + 1 + + + + 3 + + + + 3 + + + + 2 + + + + 2 + + + + 1 + + + + 1 + + + + + + + 3 + + + + + 2 + + + + + 1 + + + + + 3 + + + + + + diff --git a/slides/cse4562sp2018/graphics/2018-02-12-Join-2PassHash.svg b/slides/cse4562sp2018/graphics/2018-02-12-Join-2PassHash.svg new file mode 100644 index 00000000..d254f98f --- /dev/null +++ b/slides/cse4562sp2018/graphics/2018-02-12-Join-2PassHash.svg @@ -0,0 +1,608 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + h(A) = 0 + h(A) = 1 + + + + + h(A) = 0 + h(A) = 1 + + + + + 1 + + + + 1 + + + + 3 + + + + 3 + + + + 2 + + + + 2 + + + + 1 + + + + 1 + + + + + + + 3 + + + + 3 + + + + 2 + + + + 2 + + + + 1 + + + + 1 + + + + 3 + + + + 3 + + + + + + + diff --git a/slides/cse4562sp2018/graphics/2018-02-12-Join-BNLJ.svg b/slides/cse4562sp2018/graphics/2018-02-12-Join-BNLJ.svg index 2d227ef3..3f28615b 100644 --- a/slides/cse4562sp2018/graphics/2018-02-12-Join-BNLJ.svg +++ b/slides/cse4562sp2018/graphics/2018-02-12-Join-BNLJ.svg @@ -9,13 +9,13 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="210mm" - height="297mm" - viewBox="0 0 210 297" + width="107.84523mm" + height="153.58023mm" + viewBox="0 0 107.84523 153.58023" version="1.1" id="svg10469" - inkscape:version="0.92.2 5c3e80d, 2017-08-06" - sodipodi:docname="2018-02-12-Join-NLJ.svg"> + inkscape:version="0.91 r13725" + sodipodi:docname="2018-02-12-Join-BNLJ.svg"> + inkscape:window-y="0" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> @@ -51,7 +55,8 @@ + id="layer1" + transform="translate(-24.696428,-35.190475)"> diff --git a/slides/cse4562sp2018/graphics/2018-02-12-Join-Grid.svg b/slides/cse4562sp2018/graphics/2018-02-12-Join-Grid.svg new file mode 100644 index 00000000..16848069 --- /dev/null +++ b/slides/cse4562sp2018/graphics/2018-02-12-Join-Grid.svg @@ -0,0 +1,368 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + 1 + 3 + 2 + 1 + + + + + + + + + 3 + 2 + 3 + 1 + + + + + + + + + 3 + 2 + 3 + 1 + 1 + + + + diff --git a/slides/cse4562sp2018/graphics/2018-02-12-Join-NLJ.svg b/slides/cse4562sp2018/graphics/2018-02-12-Join-NLJ.svg index 5a44cba7..777c5202 100644 --- a/slides/cse4562sp2018/graphics/2018-02-12-Join-NLJ.svg +++ b/slides/cse4562sp2018/graphics/2018-02-12-Join-NLJ.svg @@ -10,11 +10,11 @@ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="107.84523mm" - height="153.58023mm" - viewBox="0 0 107.84523 153.58023" + height="145.11356mm" + viewBox="0 0 107.84523 145.11356" version="1.1" id="svg10469" - inkscape:version="0.92.2 5c3e80d, 2017-08-06" + inkscape:version="0.91 r13725" sodipodi:docname="2018-02-12-Join-NLJ.svg"> @@ -26,15 +26,15 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1" - inkscape:cx="134.65917" - inkscape:cy="153.73742" + inkscape:cx="-113.84083" + inkscape:cy="81.737399" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="false" - inkscape:window-width="1920" - inkscape:window-height="1031" + inkscape:window-width="2560" + inkscape:window-height="1388" inkscape:window-x="0" - inkscape:window-y="1" + inkscape:window-y="0" inkscape:window-maximized="1" fit-margin-top="0" fit-margin-left="0" @@ -56,219 +56,208 @@ inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" - transform="translate(-24.696428,-35.190475)"> + transform="translate(-24.696428,-35.190484)"> + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="g4221" + class="fragment" + transform="matrix(1.0317471,0,0,0.99998823,-1.6524342,0.00126849)"> + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + id="g4263" + class="fragment"> + ... + ... + ... diff --git a/slides/cse4562sp2018/graphics/2018-02-12-Join-OrderGrid.svg b/slides/cse4562sp2018/graphics/2018-02-12-Join-OrderGrid.svg new file mode 100644 index 00000000..8c7c0c45 --- /dev/null +++ b/slides/cse4562sp2018/graphics/2018-02-12-Join-OrderGrid.svg @@ -0,0 +1,353 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + 3 + 3 + + + + + + 2 + + + + + + + + 1 + 1 + + + + + + + 1 + 1 + 2 + 3 + + + + + + + 1 + 2 + 3 + 3 + + + diff --git a/slides/cse4562sp2018/graphics/2018-02-12-Join-SortMerge.svg b/slides/cse4562sp2018/graphics/2018-02-12-Join-SortMerge.svg new file mode 100644 index 00000000..39f1c5e9 --- /dev/null +++ b/slides/cse4562sp2018/graphics/2018-02-12-Join-SortMerge.svg @@ -0,0 +1,303 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + 1 + + + + 1 + + + + + + + 1 + + + + 2 + + + + + + 2 + + + + + + 3 + + + + 3 + + + + + + 3 + + + + + +