









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Favor, Sue Paradise, Sal 231
123
Mach, Chris
401
Rodgers, Bill
616
Smith, Mary Yost, Ned
819
Alm, LouisLink, StevePatch, Linda
Jones, Jim
983
183 14 93 281
Ming, YaoTuring, Alan
709 933
block 1 of file
block 2 of file
block N of file
Name
Name
Name
assuming N data blocks, R records per block, I/O cost of D and“record processing time” of C what are the costs of: 2D+C2D+C
N(D+RC) N(D+RC)/
inserting a record,deleting record given RID
(ignore reclaiming space)
scan,search for “key” w/ equality selection,search w/ range selection?
// **********************************************************// page class constructor void HFPage::init(PageId pageNo){
nextPage = prevPage = INVALID_PAGE;slotCnt
// no slots in use
curPage
= pageNo;
usedPtr
= sizeof(data);
// offset of used space in data array
freeSpace = sizeof(data) + sizeof(slot_t); // amount of space available
// (initially one unused slot)
Also called a
sequential
file.
File records are kept sorted by the values of an
ordering field
Insertion is expensive: records must be inserted in the correct order.
It is common to keep a separate unordered
overflow
(or
transaction
) file
for new records to improve insertion efficiency; this is periodicallymerged with the main ordered file.
binary search
can be used to search for a record on its
ordering
field
value.
This requires reading and searching log
2
of the file blocks on the
average, an improvement over linear search.
Reading the records in order of the ordering field is quite efficient.
There are numerous methods for collision resolution, including thefollowing:
Open addressing
: Proceeding from the occupied position specified by
the hash address, the program checks the subsequent positions inorder until an unused (empty) position is found.
Chaining
: For this method, various overflow locations are kept, usually
by extending the array with a number of overflow positions. In addition,a pointer field is added to each record location. A collision is resolved byplacing the new record in an unused overflow location and setting thepointer of the occupied hash address location to the address of thatoverflow location.
Multiple hashing
: The program applies a second hash function if the
first results in a collision. If another collision results, the program usesopen addressing or applies a third hash function and then uses openaddressing if necessary.
HeapSortedHashed
scan
equality
range
insert
delete
search
search