Presentation is loading. Please wait.

Presentation is loading. Please wait.

2015-12-101 Index Tuning Conventional index. Overview.

Similar presentations


Presentation on theme: "2015-12-101 Index Tuning Conventional index. Overview."— Presentation transcript:

1 2015-12-101 Index Tuning Conventional index

2 Overview

3 2015-12-103 Duplicate keys 10 20 10 30 20 30 45 40

4 2015-12-104 10 20 10 30 20 30 45 40 10 20 30 10 20 10 30 20 30 45 40 10 20 30 Dense index, one way to implement? Query –Look for the first K, then search forward Duplicate keys

5 2015-12-105 10 20 10 30 20 30 45 40 10 20 30 40 Dense index, better way? Duplicate keys Each pointer points to the first of records with key K Query –Find the first occurrence, then move forward

6 2015-12-106 10 20 10 30 20 30 45 40 10 20 30 Sparse index, one way? Duplicate keys careful if looking for 20 or 30! Find the last index entry with key <=K Then, search backward until coming to the first entry or meeting an index entry E 2 with key strictly less than k

7 2015-12-107 10 20 10 30 20 30 45 40 10 20 30 Sparse index, another way? Duplicate keys – place first new key from block

8 2015-12-108 Duplicate values, primary index Index may point to first instance of each value only File Index Summary a a a b 

9 2015-12-109 Deletion from sparse index 20 10 40 30 60 50 80 70 10 30 50 70 90 110 130 150

10 2015-12-1010 Deletion from sparse index 20 10 40 30 60 50 80 70 10 30 50 70 90 110 130 150 – delete record 40

11 2015-12-1011 Deletion from sparse index 20 10 40 30 60 50 80 70 10 30 50 70 90 110 130 150 – delete record 30 40

12 2015-12-1012 Deletion from sparse index 20 10 40 30 60 50 80 70 10 30 50 70 90 110 130 150 – delete records 30 & 40 50 70

13 2015-12-1013 Deletion from dense index 20 10 40 30 60 50 80 70 10 20 30 40 50 60 70 80

14 2015-12-1014 Deletion from dense index 20 10 40 30 60 50 80 70 10 20 30 40 50 60 70 80 – delete record 30 40

15 2015-12-1015 Insertion, sparse index case 20 1030 50 4060 10 30 40 60

16 2015-12-1016 Insertion, sparse index case 20 1030 50 4060 10 30 40 60 – insert record 34 34 our lucky day! we have free space where we need it!

17 2015-12-1017 Insertion, sparse index case 20 1030 50 4060 10 30 40 60 – insert record 15 15 20 30 20 Illustrated: Immediate reorganization In principle, we may have had to slide every record to the end of the file Variation: – insert new block (chained file) – update index

18 2015-12-1018 Insertion, sparse index case 20 1030 50 4060 10 30 40 60 – insert record 25 25 overflow blocks (reorganize later...) No index entry for overflow blocks, which is considered as an extension of data block

19 2015-12-1019 Insertion, dense index case Similar Often more expensive...

20 summary


Download ppt "2015-12-101 Index Tuning Conventional index. Overview."

Similar presentations


Ads by Google