written 2.6 years ago by |
Solution:
Hashing
- Hashing technique is used to calculate the direct location of a data record on the disk without using index structure.
- That is used to index and retrieve items in a database as it is faster to search that specific item, using the shorter hashed key instead of using its original value.
- A hash function is a simple mathematical function to any complex mathematical function.
Types of Hashing Techniques:
There are two types of SQL hashing techniques:
(I) Static Hashing
(II) Dynamic Hashing
(I) Static Hashing Techniques:
- Static hashing is the number of data buckets in memory remains constant throughout.
- That is a method of hashing, or shortening a string of characters in computer programming, in which the set of shortened characters remains the same length to improve the ease with which data can be accessed.
Static Hash Functions:
- Inserting a record:
When a new record requires to be inserted into the table, you can generate an address for the new record using its hash key and record is stored in that location.
- Searching a record:
When you need to retrieve the record, the same hash function should be helpful to retrieve the address of the bucket where data should be stored.
- Update a Record:
we will first search it using a hash function, and then the data record is updated.
This situation in the static hashing is known as bucket overflow, This is a critical situation in this method.
(II) Dynamic Hashing:
In dynamic hashing, the hash function helps you to create a large number of values.
This method is used to overcome the problems of static hashing like bucket overflow.
This hashing is provides a mechanism, in which data buckets are added and removed dynamically and on-demand.
Dynamic hashing is also known as extended hashing.