Then search for the record one additional block

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: otal block accesses is 6 + 1 = 7. 12 Single-level indexing (case 2) data records are not ordered by keys I.e. index random file: Ri = 9 + 6 = 15 bytes per index entry, 1024 bf i = (B / Ri ) = = 68 entries per block, 15 the no. of index entries b = 30000, the no. of index blocks 30000 bi = (b / bf i ) = = 442 index block 68 Using binary search, accesses at index file. (log 2 bi ) = (log 2 442) = 9 block 13 Then search for the record, one additional block access is needed, so the total block accesses is 9 + 1 = 10. Multi-level Indexes E.g. the dense secondary index of Example is converted into a multi-level index. Then Ri = (9 + 6) = 15 bytes per index entry, bf i = 68, b1 = 442 blocks for the first level b2 = (b1 / bf i ) = (442 / 68) = 7 blocks for the 2nd level b3 = (b2 / bf i ) = (7 / 68) = 1 block for the 3rd (top) level, and h = 3 levels of the index. To search for a record using the multilevel index, one additional block access is needed, so the total block accesses is h+ 1 = 4 vs. 10 (one-level indexing) 14 Multi-level Indexes (Cont.) Assume that all index block were full # of access h = 1 + log n (NBLK data ) , n = no. of index block entries 15 Eg. An indexed sequential file with 1,000,000 records, 200 bytes/record, 2,000 bytes/block, bf=10, primary key = 10 bytes, pointer field = 6 bytes, then h = ? Sol: 106 = 105 NBLK data = 10 2000 = 125 BFindex = 10 + 6 log10 105 5 5 h = 1 + log125 10 = 1 + = 1+ =4...
View Full Document

Ask a homework question - tutors are online