MySQL uses a B + Tree index. Data is stored on disk, so if the index is based on a binary tree, this involves many times the number of disk i/o,i/o depends on the height of the tree, greatly reducing the speed of the query. With the B + tree, this multi-path search tree structure allows three times I/O to implement millions data queries.
Principles for indexing:
The leftmost prefix matching principle, very important principle, MySQL will always match right until it encounters a range query (>, <, between, like) to stop the match, such as a = 1 and B = 2 and C > 3 and D = 4 If set (A,b,c,d) Shun The index of the order, D is not indexed, if the establishment (A,B,D,C) index can be used, a,b,d order can be arbitrarily adjusted.
Reference Links:
Http://tech.meituan.com/mysql-index.html
MySQL indexing principle and slow query optimization