From Unordered Files to Indexing PowerPoint PPT Presentation

presentation player overlay
1 / 14
About This Presentation
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