Hashing in DBMS
Hashing in DBMS
Hashing technique is very inefficient to search all the index values and reach the
desired data. Hashing technique is used to calculate the direct location of a data
record on the disk without using index structure.
In this technique, data is stored at the data blocks whose address is generated by
using the hashing function. The memory location where these records are stored is
known as data bucket or data blocks.
Static Hashing
In static hashing, the resultant data bucket address will always be the same. That
means if we generate an address for EMP_ID =103 using the hash function mod (5)
then it will always result in same bucket address 3. Here, there will be no change in
the bucket address.
Hence in this static hashing, the number of data buckets in memory remains constant
throughout. In this example, we will have five data buckets in the memory used to
store the data.
o 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.
o 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.
o Update a Record
To update a record, we will first search it using a hash function, and then the data
record is updated.