DBMS Static Hashing

Last Updated : 23 Jun 2026

In the previous chapter, we learned about hashing and how a hash function is used to determine the storage location of a record. One of the simplest hashing techniques used in DBMS is Static Hashing.

In this chapter, you will learn what Static Hashing is, how it works, its structure, advantages, limitations, and examples of static hashing in DBMS.

What is Static Hashing?

Static Hashing is a hashing technique in which the number of data buckets remains fixed throughout the lifetime of the database. The address generated by the hash function for a particular key always remains the same unless the hash function itself is changed.

For example, if a hash function EMP_ID mod 5 is used and the value of EMP_ID = 103, the generated bucket address will be:

103 mod 5 = 3

The record will always be stored in Bucket 3.

DBMS Static Hashing

Since the number of buckets is fixed, no new buckets are created when the amount of data increases. All records are stored within the predefined set of buckets.

Example of Static Hashing

Assume a hash function:

Hash(Key) = Key mod 5

This creates five buckets: 0, 1, 2, 3, and 4.

EMP_IDBucket Address
1011
1022
1033
1044
1050

The generated bucket address determines where the record will be stored.

Operations of Static Hashing

  • Searching a record

When a record needs to be searched, then the same hash function retrieves the address of the bucket where the data is stored.

  • Insert a Record

When a new record is inserted into the table, then we will generate an address for a new record based on the hash key and record is stored in that location.

  • Delete a Record

To delete a record, we will first fetch the record which is supposed to be deleted. Then we will delete the records for that address in memory.

  • Update a Record

To update a record, we will first search it using a hash function, and then the data record is updated.

If we want to insert some new record into the file but the address of a data bucket generated by the hash function is not empty, or data already exists in that address. This situation in the static hashing is known as bucket overflow. This is a critical situation in this method.

To overcome this situation, there are various methods. Some commonly used methods are as follows:

1. Open Hashing

When a hash function generates an address at which data is already stored, then the next bucket will be allocated to it. This mechanism is called as Linear Probing.

For example: suppose R3 is a new address which needs to be inserted, the hash function generates address as 112 for R3. But the generated address is already full. So the system searches next available data bucket, 113 and assigns R3 to it.

DBMS Static Hashing

2. Close Hashing

When buckets are full, then a new data bucket is allocated for the same hash result and is linked after the previous one. This mechanism is known as Overflow chaining.

For example: Suppose R3 is a new address which needs to be inserted into the table, the hash function generates address as 110 for it. But this bucket is full to store the new data. In this case, a new bucket is inserted at the end of 110 buckets and is linked to it.

DBMS Static Hashing

Limitation of Static Hashing

As the number of records grows, a bucket may become full. When multiple records are mapped to the same bucket, an overflow condition can occur. Since the number of buckets is fixed, handling overflow becomes more difficult in large databases.


Next TopicDynamic Hashing