Index data structure (Hash, B + Tree)

A data structure of the index's classification

  • Hash
  • B+Tree

Two. Hash

  1. Disorderly Hash Table
    [Features] Introduction: Although the disorder can quickly Hash table queries accurate, but does not support range queries. If the index of unordered Hash table, all of the data to be scanned, resulting in very slow query;
    [] usage scenarios: the equivalent query that Key-Value scenarios, such as: the Redis;

  2. Ordered Hash Table
    [Features] Introduction: ordered Hash table queries for static data. When to add, delete, change when data changes its structure. Such as: increasing operation when, after all the nodes have the new position after the shift, the cost is high.
    [Use] Scene: the equivalent queries, range queries. It can be used as static storage engine, save static data. Such as: Taobao bill.

Three. B + Tree

  1. B-Tree
    node can store multiple elements, the tree is higher than B-Tree is perfectly balanced binary tree height overall, improve the efficiency of disk IO.

  2. B + Tree
    [Features] Introduction: B + Tree is a modification of the B-Tree. Non-leaf nodes store only the key information, there is a chain of pointers, all leaf nodes among data records are stored in a leaf node, increasing the efficiency range lookup.
    Here Insert Picture Description
    Usage scenarios]: Mysql indexes use B + trees to improve the efficiency of disk IO and range queries when the query index.

    【Note】:B+树中一个节点为页的倍数最为合适,不是页的倍数会造成资源的浪费。

Published 70 original articles · won praise 4 · Views 6379

Guess you like

Origin blog.csdn.net/qq_44837912/article/details/104360465