]> git.somenet.org - pub/jan/adbs.git/blob - ex1/main_4.tex
ex1.4(a) - verbatim copy. TODO: fix overflow.
[pub/jan/adbs.git] / ex1 / main_4.tex
1 %ex1.4
2
3 \begin{enumerate}[label=(\alph*)]
4 \item Hash Join, then Merge Join
5 \begin{verbatim}
6 Merge Join  (cost=126688.84..189746.85 rows=4812309 width=12) (actual time=1235.201..3507.532 rows=4790517 loops=1)
7   Output: r.a, r.b, s.c
8   Merge Cond: ((t.a = r.a) AND (t.c = s.c))
9   Buffers: shared hit=138, temp read=1320 written=3593
10   ->  Sort  (cost=809.39..834.39 rows=10000 width=8) (actual time=15.180..17.809 rows=10000 loops=1)
11         Output: t.a, t.c
12         Sort Key: t.a, t.c
13         Sort Method: quicksort  Memory: 853kB
14         Buffers: shared hit=45
15         ->  Seq Scan on public.t  (cost=0.00..145.00 rows=10000 width=8) (actual time=0.036..4.271 rows=10000 loops=1)
16               Output: t.a, t.c
17               Buffers: shared hit=45
18   ->  Materialize  (cost=125878.37..130770.59 rows=978445 width=12) (actual time=1220.009..1810.482 rows=4790518 loops=1)
19         Output: r.a, r.b, s.c
20         Buffers: shared hit=93, temp read=1320 written=3593
21         ->  Sort  (cost=125878.37..128324.48 rows=978445 width=12) (actual time=1220.003..1267.097 rows=105629 loops=1)
22               Output: r.a, r.b, s.c
23               Sort Key: r.a, s.c
24               Sort Method: external merge  Disk: 21312kB
25               Buffers: shared hit=93, temp read=1320 written=3593
26               ->  Hash Join  (cost=270.00..11799.45 rows=978445 width=12) (actual time=7.133..326.364 rows=993774 loops=1)
27                     Output: r.a, r.b, s.c
28                     Hash Cond: (r.b = s.b)
29                     Buffers: shared hit=93
30                     ->  Seq Scan on public.r  (cost=0.00..145.00 rows=10000 width=8) (actual time=0.023..2.157 rows=10000 loops=1)
31                           Output: r.a, r.b
32                           Buffers: shared hit=45
33                     ->  Hash  (cost=145.00..145.00 rows=10000 width=8) (actual time=7.022..7.022 rows=10000 loops=1)
34                           Output: s.c, s.b
35                           Buckets: 16384  Batches: 1  Memory Usage: 519kB
36                           Buffers: shared hit=45
37                           ->  Seq Scan on public.s  (cost=0.00..145.00 rows=10000 width=8) (actual time=0.021..3.459 rows=10000 loops=1)
38                                 Output: s.c, s.b
39                                 Buffers: shared hit=45
40 Planning time: 0.899 ms
41 Execution time: 4040.426 ms
42
43 \end{verbatim}
44
45 \item
46
47 Only Merge join: Total cost: 190481.63
48 Only Hash join: Total cost: 378418.91
49 Only Nestloop: Total cost: 174352535.00
50
51 \end{enumerate}