0% found this document useful (0 votes)
0 views3 pages

Dynamic Hashing Notes

Dynamic hashing is a flexible database method that automatically adjusts storage structures as data size changes, addressing the limitations of static hashing. It utilizes components like hash functions, directories, and buckets to efficiently manage records, reducing overflow and improving access speed. While it offers advantages in adaptability and efficiency, it requires additional memory and is more complex to implement than static hashing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views3 pages

Dynamic Hashing Notes

Dynamic hashing is a flexible database method that automatically adjusts storage structures as data size changes, addressing the limitations of static hashing. It utilizes components like hash functions, directories, and buckets to efficiently manage records, reducing overflow and improving access speed. While it offers advantages in adaptability and efficiency, it requires additional memory and is more complex to implement than static hashing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Dynamic Hashing in DBMS (Long Answer for Exams)

Introduction:

Dynamic hashing is a method used in databases to store and manage data efficiently when the size

of the data keeps changing.

It allows the system to grow and shrink the storage structure automatically as records are inserted or

deleted.

It is mainly used in situations where the number of records is not fixed.

Need for Dynamic Hashing:

In static hashing, the number of buckets (storage containers) is fixed. When too many records are

inserted, some buckets overflow,

leading to slow performance. Dynamic hashing solves this problem by adjusting the structure based

on the current number of records.

Main Components of Dynamic Hashing:

1. Hash Function:

- Converts a key (like a roll number or ID) into a binary hash value.

2. Directory:

- A table that holds pointers to buckets.

- Uses Global Depth (GD) to decide how many bits to use for indexing.

3. Buckets:

- Where the actual records are stored.

- Each bucket has its own Local Depth (LD).


4. Global Depth (GD):

- Number of bits used from the hash value to search the directory.

5. Local Depth (LD):

- Number of bits used to manage the data in a specific bucket.

Working of Dynamic Hashing:

1. When a record is added, a hash function is applied to the key.

2. The first GD bits of the hash result are used to find the correct bucket from the directory.

3. If the bucket has space, the record is stored.

4. If the bucket is full:

- If LD < GD: The bucket is split, and LD is increased by 1.

- 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.

If we insert more data and a bucket overflows:

- Check LD.

- If needed, double the directory size.

- Then split the bucket and redistribute the data.

Advantages of Dynamic Hashing:

- Automatically adjusts as data grows or shrinks.

- Reduces chances of overflow.

- Faster access to records.

- Efficient use of space in the long run.


Disadvantages:

- Requires extra memory for the directory.

- Slightly complex to implement compared to static hashing.

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.

You might also like