Topic 2: Indexing Chapters 10 and 11 of Cow Book
Arun Kumar
1
CSE 132C Database System Implementation Arun Kumar Topic 2: - - PowerPoint PPT Presentation
CSE 132C Database System Implementation Arun Kumar Topic 2: Indexing Chapters 10 and 11 of Cow Book Slide ACKs: Jignesh Patel, Paris Koutris 1 Motivation for Indexing Consider the following SQL query: Movies (M) MovieID Name
1
2
3
4
5
6
7
8
h 1 N-1
9
10
11
12
13
17 24 30 2* 3* 5* 7* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39* 13
14
R1 K 1 R 2 K2 K n P n+1
record 1 record 2 Next Page Pointer
Rn
record n
P0
Prev Page Pointer
P1 K 1 P2 K 2 P3 K m P m+1
Pointer to a page with Values < K1 Pointer to a page with values s.t. K1≤ Values < K2 Pointer to a page with values ≥Km Pointer to a page with values s.t., K2≤ Values < K3
Pm
15
16
17
17 24 30 2* 3* 5* 7* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39* 13
2* 3* 5* 7* 8*
18
5 24 30 17 13
19
2* 3*
17 24 30 14*16* 19*20*22* 24* 27*29* 33*34*38*39* 13 5 7* 5* 8*
20
17 24 30 2* 3* 5* 7* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39* 13 8* 14* 16* 8
21
22
27*29* 2* 3* Root 17 24 30 14*16* 19* 20*22* 24* 33*34*38*39* 13 5 7* 5* 8* 27 24* 27* 29*
23
30 19* 27* 29* 33* 34* 38* 39*
2* 3* 7* 14* 16* 19* 27* 29* 33* 34* 38* 39* 5* 8*
30 13 5 17
24
13 5 17 20 22 30 14* 16* 17*18* 20* 33*34*38* 39* 22* 27*29* 21* 7* 5* 8* 3* 2*
25
14*16* 33* 34*38* 39* 22* 27*29* 17*18* 20* 21* 7* 5* 8* 2* 3*
13 5 17 30 20 22
26
27
28
29
30
31
14 5 14*16* 17*18* 20* 22* 27* 21* 7* 5* 3* 2*
14 17 20
32
33
34
h 1 N-1
2
35
(15, Avatar, …) h (52, Gravity, …) (20, Inception, …) (74, Blue …)
36
37
38
2 2 4* 12* 32* 16* 2 1* 13* 41* 17* 2 10* 2 7* 15*
39
40
2 2 4* 12* 32* 16* 2 1* 13* 41* 17* 2 10* 2 7* 15*
3 32* 16* 24* 3 4* 12*
41
3 3 32* 16* 24* 2 1* 13* 41* 17* 2 10* 2 7* 15*
3 4* 12*
18*
3 13*
3 1* 41* 17*
42
43
2 2 4* 12* 2 1* 13* 41* 17* 2 26* 2 7* 15*
1
44
45