Docsity

Database Systems: Lecture Notes on Indexing - CS 4420, Study notes of Computer Science

Toggle sidebar
bg1
1
DB05 Introduction
Prepared by Ling Liu
CS 4420 Database System Implementation
Indexing
Ling Liu
Associate Professor
College of Computing, Georgia Tech
2
DB05 Introduction
Prepared by Ling Liu
Lecture Outline
Review of Last Lecture:
zDisk Organization
ÆHow to lay out data on disk
)Options for Storing Records in blocks
ÆHow to move it to memory
zIndexing Introduction
Today’s Lecture
zIndexing (continues …)
ÆConventional indexes
ÆB-trees
ÆHashing schemes
pf3
pf4
pf5

Partial preview of the text

Download Database Systems: Lecture Notes on Indexing - CS 4420 and more Study notes Computer Science in PDF only on Docsity!

1 Prepared by Ling Liu

CS 4420 Database System Implementation

Indexing

Ling Liu Associate Professor College of Computing, Georgia Tech

2

DB05 (^) Introduction

Lecture Outline

„ Review of Last Lecture:

z Disk Organization

ÆHow to lay out data on disk ) Options for Storing Records in blocks ÆHow to move it to memory

z Indexing Introduction

„ Today’s Lecture

z Indexing (continues …)

Æ Conventional indexes ÆB-trees ÆHashing schemes

3 Prepared by Ling Liu

Conventional index

„ Basic Ideas:

z Sparse z Dense z Multi-level…

„ Duplicate Keys

„ Deletion/Insertion

„ Secondary indexes

4

DB05 (^) Introduction

Dense v.s Sparse Index

„ Dense Index:

z Every key in the data file is represented in the index file

„ Pro:

z A dense index, if fits in the memory, is very efficient in locating a record given a key

„ Con:

z A dense index, if too big and doesn’t fit into the memory, will be expense when used to find a record given its key

7 Prepared by Ling Liu

Sequential File

Sparse Index

10 30 50 70 90 110 130 150 170 190 210 230

Normally keeps only one key per data block

8

DB05 (^) Introduction

Sequential File

Sparse 2nd level

10 30 50 70 90 110 130 150 170 190 210 230

10 90 170 250

330 410 490 570

9 Prepared by Ling Liu

Terms

„ Index: sequential file

„ Search key ( ≠ primary key)

„ Primary index (on Sequencing field)

„ Secondary index

„ Dense index (all Search Key values in)

„ Sparse index

„ Multi-level index

10

DB05 (^) Introduction

Primary Key and Primary Index

Relation Students Name id dept SMITH 123 CS Johnson 522 EE Mary 444 CS

Note by J. Ullman

•Primary Key + Primary Index: •Option 1: Storing the relation as it is •Option 2: Storing the relation in the ascending order of id •Index: Sequential file

13

Conventional index

„ Basic Ideas:

z Sparse z Dense z Multi-level…

„ Duplicate Keys

„ Deletion/Insertion

„ Secondary indexes