当前位置:网站首页>Btree index and Hash index

Btree index and Hash index

2022-08-10 23:12:00 Small wood with

Hash Index

The location where the data is stored is located by calculating the Hash value of the data, so when querying the data, you can directly locate the location of the data, without the need to search for the data again and again through the binary tree like the B-tree.Very efficient.But why are Hash indexes rarely used?
Disadvantages:

  • Only specified data can be queried, and range query cannot be performed. Searches such as < >= in cannot be realized
  • The data cannot be sorted because the size of the hash value of the data does not represent the size of the data itself
  • Cannot avoid full table scan through index, because the range cannot be delineated, all can only scan all data

BTree Index

It is a very good index structure. It is realized through the structure of B+ tree. It builds an index tree by extracting index fields, so as to locate the cache page where the data is located when querying, so as to realize the range filtering operation of the data.
And the index can also be used when there is no wildcard "zhang%" on the left side of the like statement.It is very suitable for operations such as sorting and range querying of large amounts of data.

原网站

版权声明
本文为[Small wood with]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208102231117783.html