Note9-indexing - CSc134 Organization 9. YingJin California state University Sacramento 1 Structure Orderedindexfile

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

View Full Document Right Arrow Icon
1 CSc 134 Database Management and File  Organization   9. Indexing Structures for Files Ying Jin Computer Science Department California state University, Sacramento
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Single-level ordered indexes Structure Ordered index file Small, easy to do binary search A list of pointers to disk blocks Dense index vs. sparse (nondense) index Dense: One index entry for every record of data  files. Sparse: Has index entries for only some of the  search values. Primary index Clustering index Secondary index
Background image of page 2
3 Primary Indexes Specified on the  ordering key field  of an ordered file  of records. Ordering key field is used to  physically  order the file  records on disk. Index file consists of index entry (or index record) index entry: <primary key, pointer to disk block> index entry i: <K(i), P(i)> 1 index entry --- 1 block in the data file Anchor record of the block (block anchor): first record  in each block of the data file. Dense index or spare index  ?
Background image of page 3

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

View Full DocumentRight Arrow Icon
4
Background image of page 4
5 Access a record Load blocks of index files Search in index files load corresponding data file
Background image of page 5

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

View Full DocumentRight Arrow Icon
Average time to access a  record B: block size, R: record size, r: total number of  records. blocking factor bfr= B/R     records per block A file has b block: b =  (r/brf)   A file with  b  block, binary search to find a specific  record needs to access log 2 b block Linear search b/2. Example1
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.

This note was uploaded on 10/26/2009 for the course CSC CSC 134 taught by Professor Jinyin during the Spring '09 term at CSU Sacramento.

Page1 / 25

Note9-indexing - CSc134 Organization 9. YingJin California state University Sacramento 1 Structure Orderedindexfile

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