B-Tree index
The main purpose of the B-Tree index is to reduce the number of physical read operations. A B-Tree index is created by sorting the data on the search key and maintaining a hierarchical search data structure, which helps to search for the correct page of data entries. InnoDB
and MyISAM
storage engines, by default, use the B-Tree index. B-Tree manages to keep an equal distance from all the leaf nodes to the root node. This index speeds up data access because there is no need to scan the whole data to get the desired output. Instead, it starts with the root node. The root node holds a pointer of child nodes, and the storage engine follows these pointers to find the next path. It finds the right path by considering values in the node page. The node page defines the upper and lower bounds of values in the child nodes. At the end of the search process, the storage engine either successfully reaches a leaf page, or concludes that there is no value associated with the search. Remember...