Hashing

Hashing can be used not only for file organization but also for index-structure creation. A hash index organizes the search keys, with their associated pointers, into a hash file structure. 
Hashing is of two types:-
1.Dynamic Hashing
2.Static Hashing

Dynamic hashing- Most databases grow larger over time. If we are to use static hashing for such a database, we have three classes of options:

1. Choose a hash function based on the current file size. This option will result in performance degradation as the database grows.
2. Choose a hash function based on the anticipated size of the file at some point in the future. Although performance degradation is avoided, a significant amount of space may be wasted initially.
3. Periodically reorganize the hash structure in response to file growth. Such a reorganization involves choosing a new hash function, recomputing the hash function on every record in the file, and generating new bucket assignments. This reorganization is a massive, time-consuming operation. Furthermore, it is necessary to forbid access to the file during the reorganization. 


Several dynamic hashing techniques allow the hash function to be modified dynamically to accommodate the growth or shrinkage of the database.

Static Hashing- In the static hashing, the resultant data bucket address will always remain the same. Therefore, if you generate an address for say Student_ID = 10 using hashing function mod(3), the resultant bucket address will always be 1. So, you will not see any change in the bucket address.

Therefore, in this static hashing method, the number of data buckets in memory always remains constant.

It is of two types:- 

1.Open Hashing 

2.Close Hashing

Post a Comment

0 Comments