Open In App

Dynamic Hashing in DBMS

In this article, we will learn about dynamic hashing in DBMS. Hashing in DBMS is used for searching the needed data on the disc. As static hashing is not efficient for large databases, dynamic hashing provides a way to work efficiently with databases that can be scaled.

What is Dynamic Hashing in DBMS?

Dynamic hashing is a technique used to dynamically add and remove data buckets when demanded. Dynamic hashing can be used to solve the problem like bucket overflow which can occur in static hashing. In this method, the data bucket size grows or shrinks as the number of records increases or decreases. This allows easy insertion or deletion into the database and reduces performance issues.



Important Terminologies Related to Dynamic Hashing

How to Search a Key?

Advantages of Dynamic Hashing

Disadvantages of Dynamic Hashing

How to Insert a New Record in Database Using Dynamic Hashing?

Example

Consider the following table which contain key into bucket based on their hash address prefix

Key

Hash Address

1

10000

2

10101

3

11000

4

10011

5

11011

6

11001

7

10110

In the above table, the last two bits of 1 and 3 are 00. So, it will go into bucket B0. The last two bits of 2 and 6 are 01. So, it will go into bucket B1. The last bit of 7 is 10. So, it will go into bucket B2. The last two bits of 4 and 5 are 11. So, they will go into B3.



Mapping of Data Records into Buckets

Now, to insert key 11 with hash address 10001 into the above structure follow the steps:-

Insert Key 11 in the Data Bucket

Frequently Asked Questions on Dynamic Hashing – FAQs

How is dynamic hashing different from static hashing?

In static hashing, the resultant data bucket address will remain same while in dynamic hashing, the data bucket size shrinks or grows while increase or decrease of records.

Which hashing method is used to access the dynamic files?

Extensible hashing approach simultaneously solves the problem of making hash tables that are extendible and of making radix search trees that are balanced. It can be used to access the dynamic files.

What are popular dynamic hashing techniques?

Some popular dynamic hashing techniques are linear hashing, extensible hashing and consistent hashing.

Article Tags :