slides
parent
82a285daf7
commit
09f414d6fd
|
@ -44,6 +44,8 @@ schedule:
|
|||
slides: slide/2021-02-25-PhysicalLayout.html
|
||||
- date: "Mar. 2"
|
||||
topic: "Indexes: Tree-Based, Hash"
|
||||
materials:
|
||||
slides: slide/2021-03-02-Indexing1.html
|
||||
- date: "Mar. 4"
|
||||
topic: "Indexes: View-Based, Modern"
|
||||
- date: "Mar. 9"
|
||||
|
|
|
@ -119,11 +119,11 @@ textbook: "Ch. 8.3-8.4, 14.1-14.2, 14.4"
|
|||
</section>
|
||||
|
||||
<section>
|
||||
<svg data-src="graphics/2021-03-02-Tree-Motivation.svg"/>
|
||||
<img src="graphics/2021-03-02-Tree-Motivation.svg"/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<svg data-src="graphics/2021-03-02-Tree-Unbalanced.svg"/>
|
||||
<img data-src="graphics/2021-03-02-Tree-Unbalanced.svg" height="500px"/>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
@ -205,11 +205,11 @@ textbook: "Ch. 8.3-8.4, 14.1-14.2, 14.4"
|
|||
<dd class="fragment">Always works... but slow</dd>
|
||||
</div>
|
||||
<div class="fragment">
|
||||
<dt>$\pi_A\left(\sigma_{\wedge B = 1}( IndexScan(R,\;C < 3) ) \right)$</dt>
|
||||
<dt>$\pi_A\left(\sigma_{B = 1}( IndexScan(R,\;C < 3) ) \right)$</dt>
|
||||
<dd class="fragment">Requires a non-hash index on $C$</dd>
|
||||
</div>
|
||||
<div class="fragment">
|
||||
<dt>$\pi_A\left(\sigma_{\wedge C < 3}( IndexScan(R,\;B=1) ) \right)$</dt>
|
||||
<dt>$\pi_A\left(\sigma_{C < 3}( IndexScan(R,\;B=1) ) \right)$</dt>
|
||||
<dd class="fragment">Requires a any index on $B$</dd>
|
||||
</div>
|
||||
<div class="fragment">
|
||||
|
@ -249,7 +249,6 @@ textbook: "Ch. 8.3-8.4, 14.1-14.2, 14.4"
|
|||
<li class="fragment">For every $c_i \equiv (A = a)$: Do you have any index on $A$?</li>
|
||||
<li class="fragment">For every $c_i \in \{\; (A \geq a), (A > a), (A \leq a), (A < a)\;\}$: Do you have a tree index on $A$?</li>
|
||||
<li class="fragment">For every $c_i, c_j$, do you have an appropriate index?</li>
|
||||
<li class="fragment">etc...</li>
|
||||
<li class="fragment">A simple table scan is also an option</li>
|
||||
</ol>
|
||||
<p class="fragment">Which one do we pick?</p>
|
||||
|
@ -307,6 +306,50 @@ textbook: "Ch. 8.3-8.4, 14.1-14.2, 14.4"
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<section>
|
||||
<p>What if we need multiple sort orders?</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3>Data Organization</h3>
|
||||
<img src="2021-03-02/PrimaryVsSecondary.png" />
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3>Data Organization</h3>
|
||||
<img src="2021-03-02/Index-Types.svg" />
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3>Data Organization</h3>
|
||||
|
||||
<dl>
|
||||
<div>
|
||||
<dt>Unordered Heap</dt>
|
||||
<dd>$O(N)$ reads.</dd>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<dt>Sorted List</dt>
|
||||
<dd>$O(\log_2 N)$ <b>random</b> reads for <b>some</b> queries.</dd>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<dt>Clustered (Primary) Index</dt>
|
||||
<dd>$O(\ll N)$ <b>sequential</b> reads for <b>some</b> queries.</dd>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<dt>(Secondary) Index</dt>
|
||||
<dd>$O(\ll N)$ <b>random</b> reads for <b>some</b> queries.</dd>
|
||||
</div>
|
||||
|
||||
</dl>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
<section>
|
||||
<section>
|
||||
|
@ -322,7 +365,7 @@ textbook: "Ch. 8.3-8.4, 14.1-14.2, 14.4"
|
|||
<dd>Different $k$s are unlikely to have the same hash value.</dd>
|
||||
</dl>
|
||||
</p>
|
||||
<p class="fragment">Modulus $h(k)\mod N$ gives you a random number in $[0, N)$</p>
|
||||
<p class="fragment">$h(k)\mod N$ gives you a random number in $[0, N)$</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
|
Loading…
Reference in New Issue