Dynamic Hashing Notes
Dynamic Hashing Notes
Introduction:
Dynamic hashing is a method used in databases to store and manage data efficiently when the size
It allows the system to grow and shrink the storage structure automatically as records are inserted or
deleted.
In static hashing, the number of buckets (storage containers) is fixed. When too many records are
leading to slow performance. Dynamic hashing solves this problem by adjusting the structure based
1. Hash Function:
- Converts a key (like a roll number or ID) into a binary hash value.
2. Directory:
- Uses Global Depth (GD) to decide how many bits to use for indexing.
3. Buckets:
- Number of bits used from the hash value to search the directory.
2. The first GD bits of the hash result are used to find the correct bucket from the directory.
- If LD = GD: The directory size is doubled, GD is increased by 1, and then the bucket is split.
Example:
Let's say GD = 2. This means the directory has 2^2 = 4 entries: 00, 01, 10, 11.
- Check LD.
Conclusion:
Dynamic hashing is a smart and flexible method to handle variable-sized data in databases.
It solves the limitations of static hashing and provides faster and more efficient data management.