Why use B+ tree for index?

 

1. The file is very large, and it is impossible to store it all in memory, so it must be stored on the disk;

2. The structural organization of the index should minimize the number of disk I/O accesses during the search process;

3. The principle of locality and disk pre-reading, the length of pre-reading is generally an integer multiple of the page (page) ( in many operating systems, the page size is usually 4k)

4. The database system cleverly uses the principle of disk read-ahead, and sets the size of a node equal to one page, so that each node can be fully loaded with only one I/O . ( Because there are two arrays in the node, the address continuous ) . The structure of the red-black tree is obviously much deeper. Since logically close nodes ( parent and child ) may be physically far apart, locality cannot be exploited.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326013999&siteId=291194637