Dynamic Hashing in DBMS Last Updated : 01 Apr, 2024 Comments Improve Suggest changes Like Article Like Report 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 HashingHash Function: A mathematical function that uses the primary key to generate the address of the data block.Data Bucket: These are the memory locations that contain actual data records.Hash Index: It is the address of the data block generated by hash function.Bucket Overflow: Bucket overflow occurs when memory address generated by the hash function is already filled by some data records.How to Search a Key?Calculate the hash address of key.Calculate the number of bits used in the dictionary and denote these bits as i.Take the least significant i bits of hash address. This provides index of dictionary.This index is used to navigate to the dictionary and check for bucket address in which record may be present.Advantages of Dynamic HashingIn dynamic hashing, performance will not get affected as the amount of data grows in the system. To accommodate the data, size of memory will be increased.Dynamic hashing improve the utilization of the memory.This method is efficient to handle the dynamic database where size of data changes frequently.Disadvantages of Dynamic HashingA the amount of data changes, bucket size will also get changed. Bucket address table will keep track of these addresses because data address changes as bucket size increases or decreases. Maintenance of the bucket address table gets difficult when there is significant increase in data.In dynamic hashing, bucket overflow can happen.How to Insert a New Record in Database Using Dynamic Hashing?Follow the same procedure that we used for searching which to lead to some bucket.If space is present in that bucket, then place record in it.If bucket is full, then split the bucket and redistribute the records.ExampleConsider 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 BucketsNow, to insert key 11 with hash address 10001 into the above structure follow the steps:- Since, hash address of the bucket is 10001. It will go into bucket B1. But B1 bucket is already filled, so it will get split.Three bits of 11 and 6 are 001. So, they will go into bucket B1. And last three bits of 2 are 101. So, it will go into B4.Keys 1 and 3 are still in bucket B0. The record B is pointed by 000 and 100 entry because last two bits of both the entry are 00.Key 7 is still in bucket B2. The record B2 is pointed by 010 and 110 entry because last two bits of both the entry are 10.Key 4 and 5 are still in bucket B3. The record B3 is pointed by 111 and 011 entry because last two bits of both the entry are 11.Insert Key 11 in the Data Bucket Comment More infoAdvertise with us Next Article Dynamic Hashing in DBMS A aakanksha21c Follow Improve Article Tags : DBMS Similar Reads Hashing in DBMS Hashing in DBMS is a technique to quickly locate a data record in a database irrespective of the size of the database. For larger databases containing thousands and millions of records, the indexing data structure technique becomes very inefficient because searching a specific record through indexin 8 min read Static Hashing in DBMS Static hashing refers to a hashing technique that allows the user to search over a pre-processed dictionary (all elements present in the dictionary are final and unmodified). In this article, we will take an in-depth look at static hashing in a DBMS. What is Static Hashing?When a search key is speci 5 min read Dynamic Programming meaning in DSA Dynamic Programming is defined as an algorithmic technique that is used to solve problems by breaking them into smaller subproblems and avoiding repeated calculation of overlapping subproblems and using the property that the solution of the problem depends on the optimal solution of the subproblems 2 min read Entity in DBMS Database management systems (DBMS) are large, integrated collections of data. They play an important role in modern data management, helping agencies keep, retrieve, and manage data effectively. At the core of any DBMS is the concept of entities, which is a basic concept that refers to real-world de 5 min read Materialization View in DBMS A materialization view is nothing but a snapshot or materialized query table. It is a database object that stores the results of the query table. Materialized views in the Database Management System (DBMS) work as the existing snapshots of the data, reducing the computational overhead. Unlike standa 6 min read Hierarchical Model in DBMS Database models are critical frameworks in database management systems, dictating how data is structured, stored, and accessed. Among these, the hierarchical model stands out for its tree-like structure where data is organized in parent-child relationships, resembling a family tree. This model, sign 7 min read Last Minute Notes - DBMS Database Management System is an organized collection of interrelated data that helps in accessing data quickly, along with efficient insertion, and deletion of data into the DBMS. DBMS organizes data in the form of tables, schemas, records, etc. DBMS over File System (Limitations of File System)The 15+ min read Fully Functional Dependency in DBMS In the case of database management systems (DBMS), knowledge of dependencies is vital for the base built on this and it is a must for the development of the database that is most useful and practical. Special interdependency, which is expressed in the schema of the database, is based on the rule of 4 min read Interesting Facts about DBMS The amount of information we are surrounded with is literally exploding every single day and there is an immediate need to organise all these data. Database Management System (DBMS) extract information from millions of facts or data stored in a database. As the need for maintenance increased the dem 3 min read What is "Transparent DBMS"? A transparent Database Management System (DBMS) has been designed to give users seamless access to data while hiding the complexities of data storage, management, and retrieval. Such a system offers various forms of transparency such as location, fragmentation, replication, concurrency and failure t 6 min read Like