Slideshow:
|
|
|
Note:
|
|
|
B block numbers
<------------------->
+-----------+-------------------+-+-+-+-+-+ ...... +-+
| Filename | owner/access info | | | | | | | |
+-----------+-------------------+-+-+-+-+-+ ...... +-+
|
|
The Hash index file has B buckets
|
How to use a Hash index to find the data record with search key W:
|
Insert( K, recordPtr(K) )
{
k = h(K); // Hash the key
Find the hash bucket (= a CHAIN of disk blocks !!!)
if ( hash bucket has space )
{
insert (K, recordPtr(K)) in bucket;
}
else
{
allocate an overflow block;
insert (K, recordPtr(K)) in overflow block;
}
}
|
Delete( K )
{
k = h(K); // Hash the key
Find the hash bucket (a CHAIN of disk blocks !!!)
if ( x is found in hash bucket )
{
Delete (K, recordPtr(K)) from bucket;
}
Optional:
Consolidate overflow blocks of a bucket into few blocks
}
|
Delete oscillation caveat:
|