---
description: In this DBMS Hashing tutorial, learn What Hashing is, Hashing techniques in DBMS, Statics Hashing, Dynamic Hashing, Differences of Indexing and Hashing.
title: Hashing in DBMS: Static and Dynamic Hashing Techniques
image: https://www.guru99.com/images/static-dynamic-hashing-in-dbms.png
---

 

[Skip to content](#main) 

**⚡ Smart Summary**

Hashing in DBMS is a technique that computes the disk location of a record directly from its key, without walking an index. A hash function maps search keys to data buckets, and static or dynamic hashing manages how those buckets grow.

* ⚡ **Core Idea:** A hash function turns a key into a bucket address, so a record is found in one step rather than by index traversal.
* 🪣 **Data Bucket:** The memory location, or unit of storage, where records with the same hash are placed.
* 📌 **Static Hashing:** The bucket count is fixed, so a given key always maps to the same address.
* 📈 **Dynamic Hashing:** Buckets are added and removed on demand as the data volume changes.
* 💥 **Collision:** Two keys mapping to the same bucket, resolved by probing, rehashing, or chaining.
* 🔍 **Best For:** Exact-match lookups on the search key, where hashing beats ordered indexing.
* 📊 **Trade-off:** Ordered indexing wins for range queries; hashing wins for constant inserts and point lookups.

[ Read More ](javascript:void%280%29;) 

![Static and Dynamic Hashing in DBMS](https://www.guru99.com/images/static-dynamic-hashing-in-dbms.png)

## What is Hashing in DBMS?

In DBMS, hashing is a technique to directly search the location of desired data on the disk without using an index structure. The hashing method is used to index and retrieve items in a database, as it is faster to search for a specific item using the shorter hashed key instead of its original value. Data is stored in the form of data blocks whose address is generated by applying a hash function; the memory location where these records are stored is known as a **data block or data bucket**.

## Why Do We Need Hashing?

Here are the situations in a DBMS where you need to apply the hashing method:

* For a huge database structure, it is tough to search all the index values through all their levels and then reach the destination data block to get the desired data.
* Hashing is used to index and retrieve items in a database, because it is faster to search for a specific item using the shorter hashed key than the original value.
* Hashing is an ideal method to calculate the direct location of a data record on the disk without using an index structure.
* It is also a helpful technique for implementing dictionaries.

## Important Terminologies in Hashing

Here are important terminologies used in hashing:

* **Data bucket:** data buckets are memory locations where the records are stored. It is also known as the unit of storage.
* **Key:** a [DBMS key](https://www.guru99.com/dbms-keys.html) is an attribute or set of attributes that helps you identify a row (tuple) in a relation (table).
* **Hash function:** a mapping function that maps all the set of search keys to the address where the actual records are placed.
* **Linear Probing:** a fixed interval between probes. In this method, the next available data block is used to enter the new record, instead of overwriting the older record.
* **Quadratic Probing:** helps determine the new bucket address by adding the consecutive output of a quadratic polynomial to the starting value given by the original computation.
* **Hash index:** the address of the data block. A hash function could be a simple mathematical function or a complex one.
* **Double Hashing:** a method used in hash tables to resolve collisions by applying a second hash function.
* **Bucket Overflow:** the condition of bucket overflow is called collision. This is a fatal stage for any static hash function.

## Types of Hashing Techniques

There are mainly two types of hashing techniques in DBMS:

1. Static Hashing
2. Dynamic Hashing

The two differ mainly in whether the number of buckets is fixed, as the next two sections explain.

## Static Hashing

In static hashing, the resultant data bucket address will always remain the same.

Therefore, if you generate an address for, say, **Student\_ID = 10** using the 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 the static hashing method, the number of data buckets in memory always remains constant.

### RELATED ARTICLES

* [Relational Algebra in DBMS with Examples ](https://www.guru99.com/relational-algebra-dbms.html "Relational Algebra in DBMS with Examples")
* [Transaction Management in DBMS: States, Types & ACID ](https://www.guru99.com/dbms-transaction-management.html "Transaction Management in DBMS: States, Types & ACID")
* [14 BEST Free SQL Database Software (2026) ](https://www.guru99.com/free-database-software.html "14 BEST Free SQL Database Software (2026)")
* [60+ DBMS Interview Questions and Answers ](https://www.guru99.com/dbms-interview-questions.html "60+ DBMS Interview Questions and Answers")

### Static Hash Functions

* **Inserting a record:** when a new record needs to be inserted into the table, you generate an address for it using its hash key. Once the address is generated, the record is stored in that location.
* **Searching:** when you need to retrieve the record, the same hash function is used to retrieve the address of the bucket where the data is stored.
* **Delete a record:** using the hash function, you first fetch the record you want to delete, then remove the record from that address in memory.

Static hashing is further divided into:

1. Open hashing
2. Closed hashing

### Open Hashing

In the open hashing method, instead of overwriting the older record, the next available data block is used to enter the new record. This method is also known as linear probing.

For example, A2 is a new record you want to insert. The hash function generates the address 222, but it is already occupied by another value. That is why the system looks for the next data bucket, 501, and assigns A2 to it.

[](https://www.guru99.com/images/1/042919%5F0419%5FHashinginDB1.png)

How Open Hash Works

### Closed Hashing

In the closed hashing method, when buckets are full, a new bucket is allocated for the same hash and the result is linked after the previous one.

## Dynamic Hashing

Dynamic hashing offers a mechanism in which data buckets are added and removed dynamically and on demand. In this hashing method, the hash function helps you create a large number of values, and the structure grows or shrinks with the data. This makes it a strong fit for tables whose size cannot be predicted in advance, where static hashing would either waste space or overflow.

## Difference Between Ordered Indexing and Hashing

Below are the key differences between indexing and hashing:

| Parameters         | Ordered Indexing                                                                                                                       | Hashing                                                                                                                               |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| Storing of address | Addresses in memory are sorted according to a key value called the primary key.                                                        | Addresses are always generated using a hash function on the key value.                                                                |
| Performance        | It can decrease as data increases, because the data is stored sorted and each insert, delete, or update reorders it.                   | Performance is best with constant addition and deletion of data. For a huge database, hash file maintenance becomes costlier.         |
| Use for            | Preferred for range retrieval, where data is retrieved for a particular range.                                                         | Ideal for retrieving a particular record based on the search key, and only performs well when the hash function is on the search key. |
| Memory management  | Many unused data blocks arise from delete and update operations and cannot be released for re-use, so regular maintenance is required. | In static and dynamic hashing, memory is always managed and bucket overflow is handled to extend static hashing.                      |

In short, choose ordered [indexing](https://www.guru99.com/indexing-in-database.html) for range queries and hashing for exact-match lookups on the key.

## What is Collision?

A hash collision is a state where the resultant hashes from two or more items in the data set wrongly map to the same place in the [hash table](https://www.guru99.com/hash-table-data-structure.html).

## How to Deal With a Hashing Collision

There are two techniques you can use to avoid a hash collision:

1. **Rehashing:** this method invokes a secondary hash function, which is applied continuously until an empty slot is found where a record can be placed.
2. **Chaining:** the chaining method builds a linked list of items whose keys hash to the same value. This method requires an extra link field at each table position.

## FAQs

📌 What is the difference between static and dynamic hashing?

Static hashing keeps a fixed number of buckets, so it can overflow as data grows. Dynamic hashing adds and removes buckets on demand, so it adapts to changing data size without a full rebuild.

🔍 When is hashing a poor choice compared with indexing?

For range queries. Hashing scatters keys across buckets, so a between or greater-than query cannot walk them in order. An ordered index keeps keys sorted and is the better fit there.

💥 What causes a bucket overflow?

A bucket overflows when more records hash to it than it can hold. In static hashing this is common as data grows, and it is handled by open addressing, chaining, or overflow buckets.

🤖 How does AI use hashing on large datasets?

AI systems use hashing for fast feature lookup and for the hashing trick, which maps high-cardinality categories into a fixed vector. Similarity hashing also groups near-duplicate records efficiently.

🔗 What is the difference between rehashing and chaining?

Rehashing finds another open slot in the same table using a second function. Chaining keeps colliding records in a linked list attached to the bucket, so the table itself never fills a slot twice.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/static-dynamic-hashing-in-dbms.png","url":"https://www.guru99.com/images/static-dynamic-hashing-in-dbms.png","width":"700","height":"250","caption":"Static &amp; Dynamic Hashing in DBMS","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/hashing-in-dbms.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/dbms","name":"DBMS"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/hashing-in-dbms.html","name":"Hashing in DBMS: Static and Dynamic Hashing Techniques"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/hashing-in-dbms.html#webpage","url":"https://www.guru99.com/hashing-in-dbms.html","name":"Hashing in DBMS: Static and Dynamic Hashing Techniques","dateModified":"2026-07-22T13:32:31+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/static-dynamic-hashing-in-dbms.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/hashing-in-dbms.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/fiona","name":"Fiona Brown","description":"I'm Fiona brown, a Full Stack Developer with over a decade of experience, sharing practical guides on robust and scalable application development.","url":"https://www.guru99.com/author/fiona","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/fiona-brown-author.png","url":"https://www.guru99.com/images/fiona-brown-author.png","caption":"Fiona Brown","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"DBMS","headline":"Hashing in DBMS: Static and Dynamic Hashing Techniques","description":"In this DBMS Hashing tutorial, learn What Hashing is, Hashing techniques in DBMS, Statics Hashing, Dynamic Hashing, Differences of Indexing and Hashing.","keywords":"dbms, sql","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/fiona","name":"Fiona Brown"},"dateModified":"2026-07-22T13:32:31+05:30","image":{"@id":"https://www.guru99.com/images/static-dynamic-hashing-in-dbms.png"},"copyrightYear":"2026","name":"Hashing in DBMS: Static and Dynamic Hashing Techniques","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is the difference between static and dynamic hashing?","acceptedAnswer":{"@type":"Answer","text":"Static hashing keeps a fixed number of buckets, so it can overflow as data grows. Dynamic hashing adds and removes buckets on demand, so it adapts to changing data size without a full rebuild."}},{"@type":"Question","name":"When is hashing a poor choice compared with indexing?","acceptedAnswer":{"@type":"Answer","text":"For range queries. Hashing scatters keys across buckets, so a between or greater-than query cannot walk them in order. An ordered index keeps keys sorted and is the better fit there."}},{"@type":"Question","name":"What causes a bucket overflow?","acceptedAnswer":{"@type":"Answer","text":"A bucket overflows when more records hash to it than it can hold. In static hashing this is common as data grows, and it is handled by open addressing, chaining, or overflow buckets."}},{"@type":"Question","name":"How does AI use hashing on large datasets?","acceptedAnswer":{"@type":"Answer","text":"AI systems use hashing for fast feature lookup and for the hashing trick, which maps high-cardinality categories into a fixed vector. Similarity hashing also groups near-duplicate records efficiently."}},{"@type":"Question","name":"What is the difference between rehashing and chaining?","acceptedAnswer":{"@type":"Answer","text":"Rehashing finds another open slot in the same table using a second function. Chaining keeps colliding records in a linked list attached to the bucket, so the table itself never fills a slot twice."}}]}],"@id":"https://www.guru99.com/hashing-in-dbms.html#schema-1148211","isPartOf":{"@id":"https://www.guru99.com/hashing-in-dbms.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/hashing-in-dbms.html#webpage"}}]}
```
