File Organization in DBMS | Set 2 (original) (raw)

Last Updated : 18 Feb, 2026

In DBMS, when we want to retrieve a particular data, it becomes very inefficient to search all the index values and reach the desired data. In this situation, the hashing technique comes into the picture.

Hashing is an efficient technique to directly search the location of desired data on the disk without using an index structure. Data is stored in the data blocks whose address is generated by using a hash function.

primary_key

Hashing in DBMS

**Note: The memory location where these records are stored is called a data block or data bucket.

Hash File Organization

**Note: When all these bits are consumed then the depth value is increased linearly and twice the buckets are allocated.

Static Hashing

Static hashing is a data structure technique that maps search keys to a fixed number of addressable buckets using a consistent hash function, ensuring the database size remains constant. In static hashing, when a search-key value is provided, the hash function always computes the same address.

For example, if we want to generate an address for STUDENT_ID = 104 using a mod (5) hash function, it always results in the same bucket address 4. There will not be any changes to the bucket address here. Hence a number of data buckets in the memory for this static hashing remain constant throughout.

12

Static Hashing

Operations

**Insertion:

**Searching:

**Deletion:

**Updation: The data record that needs to be updated is first searched using the hash function and then the data record is updated.

**Note: If we want to insert some new records into the file But the data bucket address generated by the hash function is not empty or the data already exists in that address. This situation in static hashing is called bucket overflow.

Common Used Methods

**Open Hashing: In the Open hashing method, the next available data block is used to enter the new record, instead of overwriting the older one.

data_record

Open Hashing

**Closed hashing: In the Closed hashing method, a new data bucket is allocated with the same address and is linked to it after the full data bucket.

sanity_testing_process

Closed Hashing

**Quadratic probing: Quadratic probing is very much similar to open hashing or linear probing. Here, The only difference between old and new buckets is linear. The quadratic function is used to determine the new bucket address.

**Double Hashing: Double Hashing is another method similar to linear probing. Here the difference is fixed as in linear probing, but this fixed difference is calculated by using another hash function. That's why the name is double hashing.

Dynamic Hashing

Data buckets grow or shrink as the records increase or decrease & also known as extended hashing. Here,

Dynamic-Hashing

Dynamic Hashing

But the problem is that No bucket address is remaining for D3.

Dynamic-Hashing_1

Dynamic Hashing