mirror of
https://github.com/kristoferssolo/Databases-II-Cheatsheet.git
synced 2025-10-21 18:20:35 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29d1784813 | |||
| 1cd6f44af8 | |||
| 97934dd5ac | |||
| f3345f7cc1 | |||
|
|
f6128287ad | ||
| 1bf92654da | |||
| 3f4261e918 | |||
| 928bd8554f | |||
|
|
a9bb553cf3 | ||
|
|
226bf240d6 | ||
| a78da83197 | |||
|
|
5f19876f7a | ||
|
|
31dbb38511 |
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Kristofers Solo
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
BIN
export/DB2Cheatsheet.pdf
Normal file
BIN
export/DB2Cheatsheet.pdf
Normal file
Binary file not shown.
24
main.typ
24
main.typ
@ -26,7 +26,7 @@ to 1 indicating presence or true, and a bit set to 0 indicating absence or
|
|||||||
columns: 2, gutter: 2em, tablex(
|
columns: 2, gutter: 2em, tablex(
|
||||||
stroke: 0.5pt, columns: 2, colspanx(2)[Bitmaps for `gender`], `m`, `10010`, `f`, `01101`,
|
stroke: 0.5pt, columns: 2, colspanx(2)[Bitmaps for `gender`], `m`, `10010`, `f`, `01101`,
|
||||||
), tablex(
|
), tablex(
|
||||||
stroke: 0.5pt, columns: 2, colspanx(2)[Bitmaps for `income_level`], `L1`, `10010`, `L2`, `01000`, `L3`, `00001`, `L4`, `00010`, `L5`, `00000`,
|
stroke: 0.5pt, columns: 2, colspanx(2)[Bitmaps for `income_level`], `L1`, `10100`, `L2`, `01000`, `L3`, `00001`, `L4`, `00010`, `L5`, `00000`,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -87,9 +87,10 @@ Simplified version (to get the idea)
|
|||||||
for each tuple tr in r: (for each tuple ts in s: test pair (tr, ts))
|
for each tuple tr in r: (for each tuple ts in s: test pair (tr, ts))
|
||||||
```
|
```
|
||||||
|
|
||||||
// TODO: Add seek information
|
|
||||||
Block transfer cost: $n_r dot b_s + b_r$ block transfers would be required,
|
Block transfer cost: $n_r dot b_s + b_r$ block transfers would be required,
|
||||||
where $b_r$ -- blocks in relation $r$, same for $s$.
|
where $b_r$ -- blocks in relation $r$, same for $s$. Each scan of the inner
|
||||||
|
relation requires one seek, and the scan of the outer relation requires one seek
|
||||||
|
per block, leading to a total of $2 dot b_r$ seeks.
|
||||||
|
|
||||||
== Block-nested join
|
== Block-nested join
|
||||||
|
|
||||||
@ -275,7 +276,8 @@ The concept of conflict equivalence leads to the concept of conflict
|
|||||||
serializability. We say that a schedule $S$ is *conflict serializable* if it is
|
serializability. We say that a schedule $S$ is *conflict serializable* if it is
|
||||||
conflict equivalent to a serial schedule.
|
conflict equivalent to a serial schedule.
|
||||||
|
|
||||||
=== Serializability graph
|
// TODO: rename to precedence
|
||||||
|
=== Precedence graph
|
||||||
|
|
||||||
Simple and efficient method for determining the conflict seriazability of a
|
Simple and efficient method for determining the conflict seriazability of a
|
||||||
schedule. Consider a schedule $S$. We construct a directed graph, called a
|
schedule. Consider a schedule $S$. We construct a directed graph, called a
|
||||||
@ -310,6 +312,15 @@ locking protocol. We say that a locking protocol ensures conflict
|
|||||||
serializability if and only if all legal schedules are *conflict serializable*;
|
serializability if and only if all legal schedules are *conflict serializable*;
|
||||||
in other words, for all legal schedules the associated $->$ relation is acyclic.
|
in other words, for all legal schedules the associated $->$ relation is acyclic.
|
||||||
|
|
||||||
|
*Recoverable* schedule is one where, for each pair of transactions $T_i$ and
|
||||||
|
$T_j$ such that $T_j$ reads a data item previously written by $T_i$, the commit
|
||||||
|
operation of $T_i$ appears before the commit operation of $T_j$.
|
||||||
|
|
||||||
|
*Cascadeless* schedule is one where, for each pair of transactions $T_i$ and
|
||||||
|
$T_j$ such that $T_j$ reads a data item previously written by $T_i$, the commit
|
||||||
|
operation of $T_i$ appears before the read operation of $T_j$. Every cascadeless
|
||||||
|
schedule is also recoverable.
|
||||||
|
|
||||||
=== Lock-based
|
=== Lock-based
|
||||||
|
|
||||||
*Shared Lock* -- If a transaction $T_i$ has obtained a shared-mode lock (denoted
|
*Shared Lock* -- If a transaction $T_i$ has obtained a shared-mode lock (denoted
|
||||||
@ -475,7 +486,8 @@ $B=5;T_"disk"=0.001;T_"seek"=0.1$
|
|||||||
=== Nested-Loop Join Method
|
=== Nested-Loop Join Method
|
||||||
+ Nested-loop join:
|
+ Nested-loop join:
|
||||||
- For each pattern in $r_1$, search all patterns in $r_2$.
|
- For each pattern in $r_1$, search all patterns in $r_2$.
|
||||||
+ Total Combinations: $75435 dot 11456=$
|
+ Total Combinations: $75435 dot 11456$
|
||||||
+ Time Calculation for Nested-Loop Join:
|
+ Time Calculation for Nested-Loop Join:
|
||||||
- Reading and searching time for each combination: $0.001+0.1=0.101 "ms"$
|
- Reading and searching time for each combination: $0.001+0.1=0.101 "ms"$
|
||||||
- Total time: $75435 dot 11456 dot 0.101 = 87282519.36 "ms"$
|
- Total time: $75435 dot 11456 dot 0.101 = 87282519.36 "ms"$ [Authors comment:
|
||||||
|
seems fishy]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user