Hashing VS Indexing

9k views Asked by At

Both hashing and indexing are use to partition data on some pre- defined formula. But I am unable to understand the key difference between the two.

As in hashing we are dividing the data on the basis of some key value pair, similarly in Indexing also we are dividing data on some pre defined values.

Can any one please help me out the difference between Hashing and Indexing, and how to decide whether to use hashing or Indexing.

2

There are 2 answers

2
Sergey Kalinichenko On BEST ANSWER

Hashing is a specific case of indexing:

Hashing vs. Indexing

Indexing is a general name for a process of partitioning intended at speeding up data look-ups. Indexing can partition the data set based on a value of a field or a combination of fields. It can also partition the data set based on a value of a function, called hash function, computed from the data in a field or a combination of fields. In this specific case, indexing is called data hashing.

0
coolDude On

I did some research on web:

What is indexing?

Indexing is a way of sorting a number of records on multiple fields. Creating an index on a field in a table creates another data structure which holds the field value, and pointer to the record it relates to. This index structure is then sorted, allowing Binary Searches to be performed on it.

What is hashing?

Hashing is the transformation of a string of characters into a usually shorter fixed-length value or key that represents the original string. Hashing is used to index and retrieve items in a database because it is faster to find the item using the shorter hashed key than to find it using the original value.