Index principle and data structure in MySQL database, mysql Index

Source: Internet
Author: User
Tags mysql index

Index principle and data structure in MySQL database, mysql Index

There are three types of indexes in MySQL:

1. Primary Key Index: Use a primary key as a unique index.

2. Regular indexes: the implementation method is B tree and hash table.

3. Full-text index: the implementation principle is similar to inverted index. It is often used to query fields that contain keywords.

Next I will review the B-TREE and hash-table


1 B-tree

The B-tree can implement many dynamic set operations in O (lgn) time, in addition to database indexes and disk searches.

Tree B is a multi-path search Balanced Multi-Cross Tree with the following attributes:


1. If the root node is not a leaf node, it has at least two Subtrees.

2. The number of keywords contained in each non-root node j satisfies the following requirements: Running m/2 running-1 <= j <= m-1;

3. The degree of all nodes except the root node (excluding the leaf node) is exactly the sum of the number of keywords plus 1. Therefore, the number of internal sub-trees is k: optional m/2 bytes <= k <= m;

4. All leaf nodes are on the same layer.

Elements in each node are sorted in ascending order.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.