aboutsummaryrefslogtreecommitdiff
path: root/sem7/db
diff options
context:
space:
mode:
Diffstat (limited to 'sem7/db')
-rw-r--r--sem7/db/lec5.org42
-rw-r--r--sem7/db/lec_xpath.md41
2 files changed, 83 insertions, 0 deletions
diff --git a/sem7/db/lec5.org b/sem7/db/lec5.org
new file mode 100644
index 0000000..6696a50
--- /dev/null
+++ b/sem7/db/lec5.org
@@ -0,0 +1,42 @@
+* Opgave 8.3 fra bogen
+
+ #+begin_quote
+ Consider the parallel hash join algorithm in Sect. 8.4.1.2.
+ Explain what the build phase and probe phase are.
+ Is the algorithm symmetric with respect to its input relations?
+ #+end_quote
+
+** Explain build and probe phases
+
+ The build phase hashes the =R= phase into $p$ partitions.
+ Then it sends the partitions to their respective nodes.
+ The nodes in $[1, p]$ each receive the partitions and creates a local hash table for $R_j$.
+
+ In the probe phase all nodes do the same with =S= and
+ the nodes $[1, p]$ receives the partitions of =S= joins it with =R=.
+
+** Is the algorithm symmetric?
+
+ No it's not, be inner join(thus =R=) in the build phase, must be completely stored and hashed.
+ It can't start doing join on it while it's receiving.
+
+ A symmetric algorithms allows changing the order in which inputs are consumed.
+
+* Opgave 8.7 fra bogen
+
+ #+begin_quote
+ Consider a nine way join (ten relations are to be joined),
+ calculate the number of possible right-deep, left-deep, and bushy trees,
+ assuming that each relation can be joined with anyone else.
+ What do you conclude about parallel optimization?
+ #+end_quote
+
+ With right-deep we can join them in $10!$ different ways, as we just order them differently down the spine.
+ The same for left-deep.
+
+ For bushy trees we look at the leafs of the tree.
+ Here we can have $10!$ different orders again.
+ But we multiply this with the number of ways to create a 5 leaf binary tree, which i count as 3.
+
+ Therefore the end result is $2 * 10! + 3 * 10! = 5 * 10! = 18144000$.
+ Hmm that does not seem right.
diff --git a/sem7/db/lec_xpath.md b/sem7/db/lec_xpath.md
new file mode 100644
index 0000000..e28bd94
--- /dev/null
+++ b/sem7/db/lec_xpath.md
@@ -0,0 +1,41 @@
+
+Xpath is used for quering information in XML documents.
+Can also be used with postgresql databases.
+
+When using xpath, we query an abstact document structure.
+This is also represented by a nodetree.
+
+NOTE that `/, /something/else` in the slides are two different queries.
+
+# Nodetree
+
+**Document node** is the root of the tree, thus the whole element.
+Will often contain document metadata, and will point at a single root element.
+
+**Element** element represent nodes.
+
+# Location Step
+
+Stuff between two `/`'s.
+Looks like `${axis}::${node test}[${predicate_1}][${predicate_2}]`
+
+Axis will default to `child`.
+But there are many other, which also have abbreviations.
+
+# Funktioner og Expressions
+
+Man kan køre funktioner såsom concat.
+Og de kan bruge queries.
+
+```
+concat("hej", /med/dig/text())
+```
+
+# Spørgsmål
+
+Vil det her give root element flere gange.
+```
+//course/..
+```
+
+Nope det er sets, den vil ikke være der flere gange.