0% found this document useful (0 votes)
9 views

hashing

The document discusses static and dynamic hashing, focusing on how records are stored in buckets using hash functions to locate them efficiently. It explains the potential for bucket overflow due to insufficient buckets or skewed record distribution and describes methods for handling overflow, such as overflow chaining. Additionally, it contrasts closed hashing with open hashing, noting that the latter is unsuitable for database applications.

Uploaded by

selocoy319
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

hashing

The document discusses static and dynamic hashing, focusing on how records are stored in buckets using hash functions to locate them efficiently. It explains the potential for bucket overflow due to insufficient buckets or skewed record distribution and describes methods for handling overflow, such as overflow chaining. Additionally, it contrasts closed hashing with open hashing, noting that the latter is unsuitable for database applications.

Uploaded by

selocoy319
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Hashing

Static Hashing

 A bucket is a unit of storage containing one or more records (a


bucket is typically a disk block).
 In a hash file organization we obtain the bucket of a record directly
from its search-key value using a hash function.
 Hash function h is a function from the set of all search-key values K
to the set of all bucket addresses B.
 Hash function is used to locate records for access, insertion as well
as deletion.
 Records with different search-key values may be mapped to the
same bucket; thus entire bucket has to be searched sequentially to
locate a record.
Example of Hash File Organization

Hash file organization of account file, using branch_name as key

(See figure in next slide.)

 There are 10 buckets,


 The binary representation of the ith character is assumed to be the
integer i.
 The hash function returns the sum of the binary representations of
the characters modulo 10
 E.g. h(Perryridge) = 5 h(Round Hill) = 3 h(Brighton) = 3
Handling of Bucket Overflows
 Bucket overflow can occur because of
 Insufficient buckets
 Skew in distribution of records. This can occur due to two
reasons:
 multiple records have same search-key value
 chosen hash function produces non-uniform distribution of key
values
 Although the probability of bucket overflow can be reduced, it cannot
be eliminated; it is handled by using overflow buckets.
Handling of Bucket Overflows (Cont.)

 Overflow chaining – the overflow buckets of a given bucket are chained


together in a linked list.
 Above scheme is called closed hashing.
 An alternative, called open hashing, which does not use overflow
buckets, is not suitable for database applications.
Dynamic Hashing
Dynamic Hashing Using Directories
Dynamic Hashing Using Directories

You might also like