A data structure of the index's classification
- Hash
- B+Tree
Two. Hash
-
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; -
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
-
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. -
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.
Usage scenarios]: Mysql indexes use B + trees to improve the efficiency of disk IO and range queries when the query index.【Note】:
B+树中一个节点为页的倍数最为合适,不是页的倍数会造成资源的浪费。