哈希和索引之间的区别是什么?

时间:2022-10-06 04:16:00

I have studied hashing in DBMS (extensible, linear) and about Indexing in DBMS (sparse, dense, indexes based on secondary key, etc.), but I am unable to understand what the difference is between Hashing and Indexing. Are these two techniques used together or is just either used? I am confused because the purpose of both techniques seem to be to enable us to retrieve the data quickly, so I think either should be sufficient.

我曾研究过DBMS中的哈希(可扩展的,线性的)和DBMS中的索引(稀疏的,密集的,基于辅助键的索引等),但是我无法理解哈希和索引之间的区别。这两种技术是一起使用的还是只使用其中一种?我很困惑,因为这两种技术的目的似乎都是为了让我们能够快速检索数据,所以我认为这两种方法都应该足够。

Can anyone clarify the difference?

有人能澄清一下吗?

4 个解决方案

#1


13  

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.

散列是将一串字符转换为通常较短的固定长度值或表示原始字符串的键。散列用于索引和检索数据库中的项,因为使用较短的散列键查找项比使用原始值查找项要快。

I think this may clear your doubt.

我想这可以消除你的疑虑。

#2


11  

Hash is sort of an index: it can be used to locate a record based on a key -- but it doesn't preserve any order of records. Based on hash, one can't iterate to the succeeding or preceding element. This is however, what index does (in the context of databases.)

哈希是一种索引:它可用于基于键定位记录——但它不保存记录的任何顺序。基于哈希,不能迭代到后续或前面的元素。然而,这是索引的作用(在数据库的上下文中)。

#3


2  

  • Hashing do not guarantee that distinct values will hash to distinct address.
  • 散列不能保证不同的值将散列到不同的地址。
  • Collision is there in Hashing.
  • 在散列中有碰撞。
  • Hashing results in Overflow.
  • 散列结果溢出。
  • No need to access an index structure to locate data & then read data from DB File.
  • 不需要访问索引结构来定位数据,然后从DB文件中读取数据。
  • There is command to define Indexing but not for Hashing.
  • 有命令定义索引,但不用于散列。

#4


0  

hashing is advanced searching technique.i.e large data is made into small data item and stored in a table. But indexing and binary searching comes under searching in linear manner. and also indexing is used for making index(key) to combination of multiple fields

哈希是一种先进的搜索技术。大数据被制成小数据项并存储在一个表中。但是索引和二进制搜索是以线性方式进行搜索的。索引也被用来制作索引(键)以组合多个字段

#1


13  

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.

散列是将一串字符转换为通常较短的固定长度值或表示原始字符串的键。散列用于索引和检索数据库中的项,因为使用较短的散列键查找项比使用原始值查找项要快。

I think this may clear your doubt.

我想这可以消除你的疑虑。

#2


11  

Hash is sort of an index: it can be used to locate a record based on a key -- but it doesn't preserve any order of records. Based on hash, one can't iterate to the succeeding or preceding element. This is however, what index does (in the context of databases.)

哈希是一种索引:它可用于基于键定位记录——但它不保存记录的任何顺序。基于哈希,不能迭代到后续或前面的元素。然而,这是索引的作用(在数据库的上下文中)。

#3


2  

  • Hashing do not guarantee that distinct values will hash to distinct address.
  • 散列不能保证不同的值将散列到不同的地址。
  • Collision is there in Hashing.
  • 在散列中有碰撞。
  • Hashing results in Overflow.
  • 散列结果溢出。
  • No need to access an index structure to locate data & then read data from DB File.
  • 不需要访问索引结构来定位数据,然后从DB文件中读取数据。
  • There is command to define Indexing but not for Hashing.
  • 有命令定义索引,但不用于散列。

#4


0  

hashing is advanced searching technique.i.e large data is made into small data item and stored in a table. But indexing and binary searching comes under searching in linear manner. and also indexing is used for making index(key) to combination of multiple fields

哈希是一种先进的搜索技术。大数据被制成小数据项并存储在一个表中。但是索引和二进制搜索是以线性方式进行搜索的。索引也被用来制作索引(键)以组合多个字段