From Unordered Files to Indexing - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

From Unordered Files to Indexing

Description:

... 240|Blazing Saddles|comedy| address. Data file. Insert ... comedy 0. drama 6. sci fi 4. Genre index. 0. 3. 2. 1. Gene Wilder 0. Harrison Ford 1. Matt Damon 5 ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 15
Provided by: facultyK4
Category:

less

Transcript and Presenter's Notes

Title: From Unordered Files to Indexing


1
From Unordered Files to Indexing
  • CSC 402 File Management Techniques

2
Unordered Files
  • Placed in file in the order inserted (appended
    only)
  • Operations
  • Insertion
  • Deletion
  • Search
  • DB needs the file structure to support efficient
    access to records by content

3
Indexes To Access by Content
  • Index
  • Key-Reference pair
  • Simple Index

Data file
address
4
Operations using an Index
  • Search by key
  • Update

Data file
address
5
Insert with a Simple Index
address
Data file
Insert Chicago the musical with key of 201
6
Result of Insert
Data file
address
7
Deletion Using a Simple Index
Data file
address
Delete key 150
8
Result of Deletion
Not reclaiming space
address
Data file
Reclaiming space
address
Data file
9
The Index File
  • A File of SimpleIndex
  • Normal File Operations
  • When created vs opened?
  • When read?
  • When written?

10
Adjusted File API
  • bool Create(filename)
  • bool Open(filename)
  • bool Close(filename)
  • int Read(data, key)
  • int Write(data, key)
  • int Append(data)

11
Simple Indexed File Organization
12
Secondary Indexes
  • Non-primary key accesses
  • Not guaranteed to be unique

Primary index
Secondary index
240
29
13
Secondary Indexes with a Reference File
Points to record
Points to the head of list
14
Using the Secondary Indexes
Star index
Genre index
Write a Comment
User Comments (0)
About PowerShow.com