ch14-Indexing Structures for Files

ch14-Indexing Structures for Files - Copyright 2007 Ramez...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Slide 14- 1 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 14 Indexing Structures for Files
Background image of page 2
Slide 14- 3 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter Outline Types of Single-level Ordered Indexes Primary Indexes Clustering Indexes Secondary Indexes Multilevel Indexes Dynamic Multilevel Indexes Using B-Trees and B+-Trees Indexes on Multiple Keys
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Slide 14- 4 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Indexes as Access Paths A single-level index is an auxiliary file that makes it more efficient to search for a record in the data file. The index is usually specified on one field of the file (although it could be specified on several fields) One form of an index is a file of entries < field value, pointer to record> , which is ordered by field value The index is called an access path on the field.
Background image of page 4
Slide 14- 5 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Indexes as Access Paths (contd.) The index file usually occupies considerably less disk blocks than the data file because its entries are much smaller A binary search on the index yields a pointer to the file record Indexes can also be characterized as dense or sparse A dense index has an index entry for every search key value (and hence every record) in the data file. A sparse (or nondense) index , on the other hand, has index entries for only some of the search values
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Slide 14- 6 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Indexes as Access Paths (contd.) Example: Given the following data file EMPLOYEE(NAME, SSN, ADDRESS, JOB, SAL, . .. ) Suppose that: record size R=150 bytes block size B=512 bytes r=30000 records Then, we get: blocking factor Bfr= B div R= 512 div 150= 3 records/block number of file blocks b= (r/Bfr)= (30000/3)= 10000 blocks For an index on the SSN field, assume the field size V SSN =9 bytes, assume the record pointer size P R =7 bytes. Then: index entry size R I =(V SSN + P R )=(9+7)=16 bytes index blocking factor Bfr I = B div R I = 512 div 16= 32 entries/block
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 28

ch14-Indexing Structures for Files - Copyright 2007 Ramez...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online