Processing math: 100%

11.Indexing§

Files and Indexing

Keys and Indexing

Linear Indexing (1)

1 / 14 Settings
<<<>>>

Here is an array of variable length database records

Created with Raphaël 2.1.2
73
52
98
37
42
Proficient Saving... Error Saving
Server Error
Resubmit

Linear Indexing (2)

1 / 13 Settings
<<<>>>

Here is the Second Level Index Array which stores the first key value in the disk block of the index file

Created with Raphaël 2.1.2
  1. 1
  2. 2003
  3. 5894
  4. 10528
Proficient Saving... Error Saving
Server Error
Resubmit

Tree Indexing (1)

Tree Indexing (2)

1 / 16 Settings
<<<>>>

Paged BST demo. The bottom square represents blocks on disk.

Created with Raphaël 2.1.2
Created with Raphaël 2.1.2
Proficient Saving... Error Saving
Server Error
Resubmit

Tree Indexing (3)

Tree Indexing (4)

1 / 11 Settings
<<<>>>

This is the same tree as the previous slide show. Lets try to find the key 9.

Created with Raphaël 2.1.2
Created with Raphaël 2.1.2
10
5
15
3
8
13
18
2
4
7
9
12
14
17
19
10
5
15
3
8
13
18
2
4
7
9
12
14
17
19
Disk Accesses:
  1. 0
Proficient Saving... Error Saving
Server Error
Resubmit

2-3 Tree

2-3 Tree Example

Created with Raphaël 2.1.2
  1. 18
  2. 32
  1. 12
  1. 23
  2. 30
  1. 48
  1. 10
  1. 15
  1. 20
  2. 21
  1. 24
  1. 31
  1. 45
  2. 47
  1. 50
  2. 52

2-3 Tree Insertion (1)

1 / 6 Settings
<<<>>>

Simple insert into the 2-3 tree. We want to insert the key 14 into the tree.

Created with Raphaël 2.1.2
  1. 18
  2. 32
  1. 12
  1. 23
  2. 30
  1. 48
  1. 10
  1. 15
  1. 20
  2. 21
  1. 24
  1. 31
  1. 45
  2. 47
  1. 50
  2. 52
Insert:
  1. 14
Proficient Saving... Error Saving
Server Error
Resubmit

2-3 Tree Insertion (2)

1 / 9 Settings
<<<>>>

A simple node-splitting insert for a 2-3 tree. We want to insert the key 55 into the tree.

Created with Raphaël 2.1.2
  1. 18
  2. 32
  1. 12
  1. 23
  2. 30
  1. 48
  1. 10
  1. 15
  1. 20
  2. 21
  1. 24
  1. 31
  1. 45
  2. 47
  1. 50
  2. 52
Insert:
  1. 55
Proficient Saving... Error Saving
Server Error
Resubmit

2-3 Tree Insertion (3)

1 / 14 Settings
<<<>>>

Example of inserting a record that causes the 2-3 tree root to split. We want to insert the key 19 into the tree.

Created with Raphaël 2.1.2
  1. 18
  2. 32
  1. 12
  1. 23
  2. 30
  1. 48
  1. 10
  1. 15
  1. 20
  2. 21
  1. 24
  1. 31
  1. 45
  2. 47
  1. 50
  2. 52
Insert:
Promote:
  1. 19
Proficient Saving... Error Saving
Server Error
Resubmit

B-Trees (1)

B-Trees (2)

  1. B-Trees are always balanced.
  2. B-Trees keep similar-valued records together on a disk page, which takes advantage of locality of reference.
  3. B-Trees guarantee that every node in the tree will be full at least to a certain minimum percentage. This improves space efficiency while reducing the typical number of disk fetches necessary during a search or update operation.
A B-tree of order four

B+-Trees

23+-Tree Build Example

1 / 28 Settings
<<<>>>

Example 2-3+ Tree Visualization: Insert

Created with Raphaël 2.1.2
Proficient Saving... Error Saving
Server Error
Resubmit

An example of building a “23+ tree

23+-Tree Search Example

1 / 10 Settings
<<<>>>

Example 2-3+ Tree Visualization: Search

Created with Raphaël 2.1.2
  1. 15
    J
  2. 22
    X
  1. 52
    B
  1. 33
  1. 65
    S
  1. 71
    W
  2. 89
    M
  1. 71
  1. 46
  2. 65
  1. 33
    O
  1. 46
    H
  2. 47
    L
  1. 52
Proficient Saving... Error Saving
Server Error
Resubmit

An example of searching a “23+ tree

23+-Tree Delete Example

1 / 33 Settings
<<<>>>

Example 2-3+ Tree Visualization: Delete

Created with Raphaël 2.1.2
  1. 15
    J
  1. 71
    W
  2. 89
    M
  1. 22
  1. 65
    S
  2. 70
    F
  1. 51
    B
  2. 52
    T
  1. 71
  1. 46
  2. 65
  1. 46
    H
  2. 47
    L
  1. 22
    X
  2. 33
    O
  1. 51
Proficient Saving... Error Saving
Server Error
Resubmit

An example of deleting from a “23+ tree

B+-Tree Find

1 / 10 Settings
<<<>>>

Example B+ Tree Visualization: Search in a tree of degree 4

Created with Raphaël 2.1.2
  1. 10
    S
  2. 18
    E
  1. 40
    Q
  2. 55
    F
  1. 25
  2. 40
  1. 77
    A
  2. 89
    B
  1. 98
    A
  2. 127
    V
  1. 25
    T
  2. 39
    F
  1. 98
  1. 77
Proficient Saving... Error Saving
Server Error
Resubmit

An example of search in a B+ tree of order four. Internal nodes must store between two and four children.

B+-Tree Insert

1 / 42 Settings
<<<>>>

Example B+ Tree Visualization: Insert into a tree of degree 4

Created with Raphaël 2.1.2
Proficient Saving... Error Saving
Server Error
Resubmit

An example of building a B+ tree of order four.

B+-Tree Deletion

1 / 23 Settings
<<<>>>

Example B+ Tree Visualization: Delete from a tree of degree 4

Created with Raphaël 2.1.2
  1. 5
    F
  2. 10
    S
  1. 44
    Q
  2. 48
    E
  1. 12
  2. 44
  1. 67
    A
  2. 88
    B
  1. 58
    A
  2. 60
    F
  1. 12
    V
  2. 27
    T
  1. 67
  1. 58
Proficient Saving... Error Saving
Server Error
Resubmit

An example of deletion in a B+ tree of order four.

B+-Tree Insert (Degree 5)

1 / 33 Settings
<<<>>>

Example B+ Tree Visualization: Insert into a tree of degree 5

Created with Raphaël 2.1.2
Proficient Saving... Error Saving
Server Error
Resubmit

An example of building a B+ tree of degree 5

B-Tree Space Analysis (1)

B-Tree Space Analysis (2)

B-Trees: The Big Idea