What are the types of all MySQL indexes called indexes

In the MySQL Innodb storage engine, the index is the data, and the data is the index.

Index type

  1. B+ tree index: Innodb engine uses this index type internally.
  2. Hash index: Based on a hash table, it is used to precisely match the data pointed to by the index.
  3. Full-text index: only supported by MyISAM engine, mainly used to find keywords in the text, rather than directly comparing with the value in the index.
  4. Adaptive hash index: Innodb engine uses, automatically establishes a hash index according to the frequency of access.

Index type

  1. Clustered index, also called clustered index, primary key index, primary index.
  2. Non-clustered index, also called secondary index.

Clustered index

There must be one and only one table in a table, and the leaf nodes store all the column data of the row. A clustered index is generated when the table is built, and this clustered index is the place where data is added, deleted, modified, and checked. The clustered index is a B+ tree structure, and all leaf nodes are row data. The clustered index is created with the primary key. If the primary key is not created when the table is built, a unique index is used as the primary key. If there is no unique index, a hidden primary key column is generated at the bottom layer.

Nonclustered index

For non-clustered indexes, the leaf nodes only store the indexed column and primary key data. If the queried value is not in the index, it will return to the table: get the primary key value and go to the clustered index query. You can use a covering index to avoid returning to the table, create an index column that contains the query result, or only query the index column.

Non-clustered indexes are divided into:

  1. Ordinary index: The column value can be the same as the column index.
  2. Unique index: The column value is unique and the change buffer is not used.
  3. Composite index: also called joint index, composite index, index composed of multiple columns.
  4. Combined unique index: also called joint unique index, compound unique index, a unique index composed of multiple columns.

 

 

Guess you like

Origin blog.csdn.net/Anenan/article/details/115273701