您的位置:首页 > 数据库 > SQL

Index logic in MySQL& B- tree algorithm

2015-06-05 09:58 507 查看
This blog is about some basic ideas about index logic in the Database engine in MySQL, along with the simple explanation of its supporting algorithm: B- tress algorithm.

B-tree Algorithm

Index logic

**

1. B- tree algorithm

http://en.wikipedia.org/wiki/B-tree

**

The lower and upper bounds on the number of child nodes are typically fixed for a particular implementation. For example, in a 2-3 B-tree (often simply referred to as a 2-3 tree), each internal node may have only 2 or 3 child nodes.

Each internal node of a B-tree will contain a number of keys. The keys act as separation values which divide its subtrees.

Usually, the number of keys is chosen to vary between d and 2d, where d is the minimum number of keys, and d+1 is the minimum degree or branching factor of the tree.



            Figure1.1 B-tree of order 2

Deleting the key would make the internal node have d-1 keys; joining the neighbor would add d keys plus one more key brought down from the neighbor’s parent. The result is an entirely full node of 2d keys.

**

2. Index logic

**



        Figure2.1 B-tree index of MySQL5.1

where inner nodes store the pages hierarchy and the leaf nodes store pointers to indexed data information.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  index